home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / difutl27.zip / difutl27 / texinfo.tex (.txt) < prev    next >
LaTeX Document  |  1994-09-19  |  143KB  |  3,486 lines

  1. %% TeX macros to handle texinfo files
  2. %   Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 1994 Free Software Foundation, Inc.
  3. %This texinfo.tex file is free software; you can redistribute it and/or
  4. %modify it under the terms of the GNU General Public License as
  5. %published by the Free Software Foundation; either version 2, or (at
  6. %your option) any later version.
  7. %This texinfo.tex file is distributed in the hope that it will be
  8. %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  9. %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  10. %General Public License for more details.
  11. %You should have received a copy of the GNU General Public License
  12. %along with this texinfo.tex file; see the file COPYING.  If not, write
  13. %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
  14. %USA.
  15. %In other words, you are welcome to use, share and improve this program.
  16. %You are forbidden to forbid anyone else to use, share and improve
  17. %what you give them.   Help stamp out software-hoarding!
  18. % This automatically updates the version number based on RCS.
  19. \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
  20. \deftexinfoversion$Revision: 2.134 $
  21. \message{Loading texinfo package [Version \texinfoversion]:}
  22. % Print the version number if in a .fmt file.
  23. \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
  24. % Save some parts of plain tex whose names we will redefine.
  25. \let\ptextilde=\~
  26. \let\ptexlbrace=\{
  27. \let\ptexrbrace=\}
  28. \let\ptexdots=\dots
  29. \let\ptexdot=\.
  30. \let\ptexstar=\*
  31. \let\ptexend=\end
  32. \let\ptexbullet=\bullet
  33. \let\ptexb=\b
  34. \let\ptexc=\c
  35. \let\ptexi=\i
  36. \let\ptext=\t
  37. \let\ptexl=\l
  38. \let\ptexL=\L
  39. % Be sure we're in horizontal mode when doing a tie, since we make space
  40. % equivalent to this in @example-like environments. Otherwise, a space
  41. % at the beginning of a line will start with \penalty -- and
  42. % since \penalty is valid in vertical mode, we'd end up putting the
  43. % penalty on the vertical list instead of in the new paragraph.
  44. {\catcode`@ = 11
  45.  \gdef\tie{\leavevmode\penalty\@M\ }
  46. \let\~ = \tie                  % And make it available as @~.
  47. \message{Basics,}
  48. \chardef\other=12
  49. % If this character appears in an error message or help string, it
  50. % starts a new line in the output.
  51. \newlinechar = `^^J
  52. % Set up fixed words for English.
  53. \ifx\putwordChapter\undefined{\gdef\putwordChapter{Chapter}}\fi%
  54. \def\putwordInfo{Info}%
  55. \ifx\putwordSee\undefined{\gdef\putwordSee{See}}\fi%
  56. \ifx\putwordsee\undefined{\gdef\putwordsee{see}}\fi%
  57. \ifx\putwordfile\undefined{\gdef\putwordfile{file}}\fi%
  58. \ifx\putwordpage\undefined{\gdef\putwordpage{page}}\fi%
  59. \ifx\putwordsection\undefined{\gdef\putwordsection{section}}\fi%
  60. \ifx\putwordSection\undefined{\gdef\putwordSection{Section}}\fi%
  61. \ifx\putwordTableofContents\undefined{\gdef\putwordTableofContents{Table of Contents}}\fi%
  62. \ifx\putwordShortContents\undefined{\gdef\putwordShortContents{Short Contents}}\fi%
  63. \ifx\putwordAppendix\undefined{\gdef\putwordAppendix{Appendix}}\fi%
  64. % Ignore a token.
  65. \def\gobble#1{}
  66. \hyphenation{ap-pen-dix}
  67. \hyphenation{mini-buf-fer mini-buf-fers}
  68. \hyphenation{eshell}
  69. % Margin to add to right of even pages, to left of odd pages.
  70. \newdimen \bindingoffset  \bindingoffset=0pt
  71. \newdimen \normaloffset   \normaloffset=\hoffset
  72. \newdimen\pagewidth \newdimen\pageheight
  73. \pagewidth=\hsize \pageheight=\vsize
  74. % Sometimes it is convenient to have everything in the transcript file
  75. % and nothing on the terminal.  We don't just call \tracingall here,
  76. % since that produces some useless output on the terminal.
  77. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  78. \def\loggingall{\tracingcommands2 \tracingstats2
  79.    \tracingpages1 \tracingoutput1 \tracinglostchars1
  80.    \tracingmacros2 \tracingparagraphs1 \tracingrestores1
  81.    \showboxbreadth\maxdimen\showboxdepth\maxdimen
  82. %---------------------Begin change-----------------------
  83. %%%% For @cropmarks command.
  84. % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
  85. \newdimen\cornerlong \newdimen\cornerthick
  86. \newdimen \topandbottommargin
  87. \newdimen \outerhsize \newdimen \outervsize
  88. \cornerlong=1pc\cornerthick=.3pt    % These set size of cropmarks
  89. \outerhsize=7in
  90. %\outervsize=9.5in
  91. % Alternative @smallbook page size is 9.25in
  92. \outervsize=9.25in
  93. \topandbottommargin=.75in
  94. %---------------------End change-----------------------
  95. % \onepageout takes a vbox as an argument.  Note that \pagecontents
  96. % does insertions itself, but you have to call it yourself.
  97. \chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
  98. \def\onepageout#1{\hoffset=\normaloffset
  99. \ifodd\pageno  \advance\hoffset by \bindingoffset
  100. \else \advance\hoffset by -\bindingoffset\fi
  101. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  102. \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
  103. {\let\hsize=\pagewidth \makefootline}}}%
  104. \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  105. %%%% For @cropmarks command %%%%
  106. % Here is a modification of the main output routine for Near East Publications
  107. % This provides right-angle cropmarks at all four corners.
  108. % The contents of the page are centerlined into the cropmarks,
  109. % and any desired binding offset is added as an \hskip on either
  110. % site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
  111. \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
  112. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  113.          \shipout
  114.          \vbox to \outervsize{\hsize=\outerhsize
  115.                  \vbox{\line{\ewtop\hfill\ewtop}}
  116.                  \nointerlineskip
  117.                  \line{\vbox{\moveleft\cornerthick\nstop}
  118.                        \hfill
  119.                        \vbox{\moveright\cornerthick\nstop}}
  120.                  \vskip \topandbottommargin
  121.                  \centerline{\ifodd\pageno\hskip\bindingoffset\fi
  122.             \vbox{
  123.             {\let\hsize=\pagewidth \makeheadline}
  124.             \pagebody{#1}
  125.             {\let\hsize=\pagewidth \makefootline}}
  126.             \ifodd\pageno\else\hskip\bindingoffset\fi}
  127.          \vskip \topandbottommargin plus1fill minus1fill
  128.                  \boxmaxdepth\cornerthick
  129.                  \line{\vbox{\moveleft\cornerthick\nsbot}
  130.                        \hfill
  131.                        \vbox{\moveright\cornerthick\nsbot}}
  132.                  \nointerlineskip
  133.                  \vbox{\line{\ewbot\hfill\ewbot}}
  134.   \advancepageno
  135.   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  136. % Do @cropmarks to get crop marks
  137. \def\cropmarks{\let\onepageout=\croppageout }
  138. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  139. {\catcode`\@ =11
  140. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  141. \dimen@=\dp#1 \unvbox#1
  142. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  143. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  144. % Here are the rules for the cropmarks.  Note that they are
  145. % offset so that the space between them is truly \outerhsize or \outervsize
  146. % (P. A. MacKay, 12 November, 1986)
  147. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  148. \def\nstop{\vbox
  149.   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  150. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  151. \def\nsbot{\vbox
  152.   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  153. % Parse an argument, then pass it to #1.  The argument is the rest of
  154. % the input line (except we remove a trailing comment).  #1 should be a
  155. % macro which expects an ordinary undelimited TeX argument.
  156. \def\parsearg#1{%
  157.   \let\next = #1%
  158.   \begingroup
  159.     \obeylines
  160.     \futurelet\temp\parseargx
  161. % If the next token is an obeyed space (from an @example environment or
  162. % the like), remove it and recurse.  Otherwise, we're done.
  163. \def\parseargx{%
  164.   % \obeyedspace is defined far below, after the definition of \sepspaces.
  165.   \ifx\obeyedspace\temp
  166.     \expandafter\parseargdiscardspace
  167.   \else
  168.     \expandafter\parseargline
  169.   \fi
  170. % Remove a single space (as the delimiter token to the macro call).
  171. {\obeyspaces %
  172.  \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
  173. {\obeylines %
  174.   \gdef\parseargline#1^^M{%
  175.     \endgroup % End of the group started in \parsearg.
  176.     %
  177.     % First remove any @c comment, then any @comment.
  178.     % Result of each macro is put in \toks0.
  179.     \argremovec #1\c\relax %
  180.     \expandafter\argremovecomment \the\toks0 \comment\relax %
  181.     %
  182.     % Call the caller's macro, saved as \next in \parsearg.
  183.     \expandafter\next\expandafter{\the\toks0}%
  184. % Since all \c{,omment} does is throw away the argument, we can let TeX
  185. % do that for us.  The \relax here is matched by the \relax in the call
  186. % in \parseargline; it could be more or less anything, its purpose is
  187. % just to delimit the argument to the \c.
  188. \def\argremovec#1\c#2\relax{\toks0 = {#1}}
  189. \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
  190. % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
  191. %    @end itemize  @c foo
  192. % will have two active spaces as part of the argument with the
  193. % `itemize'.  Here we remove all active spaces from #1, and assign the
  194. % result to \toks0.
  195. % This loses if there are any *other* active characters besides spaces
  196. % in the argument -- _ ^ +, for example -- since they get expanded.
  197. % Fortunately, Texinfo does not define any such commands.  (If it ever
  198. % does, the catcode of the characters in questionwill have to be changed
  199. % here.)  But this means we cannot call \removeactivespaces as part of
  200. % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
  201. % that \parsearg gets might well have any character at all in it.
  202. \def\removeactivespaces#1{%
  203.   \begingroup
  204.     \ignoreactivespaces
  205.     \edef\temp{#1}%
  206.     \global\toks0 = \expandafter{\temp}%
  207.   \endgroup
  208. % Change the active space to expand to nothing.
  209. \begingroup
  210.   \obeyspaces
  211.   \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
  212. \endgroup
  213. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  214. %% These are used to keep @begin/@end levels from running away
  215. %% Call \inENV within environments (after a \begingroup)
  216. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  217. \def\ENVcheck{%
  218. \ifENV\errmessage{Still within an environment.  Type Return to continue.}
  219. \endgroup\fi} % This is not perfect, but it should reduce lossage
  220. % @begin foo  is the same as @foo, for now.
  221. \newhelp\EMsimple{Type <Return> to continue.}
  222. \outer\def\begin{\parsearg\beginxxx}
  223. \def\beginxxx #1{%
  224. \expandafter\ifx\csname #1\endcsname\relax
  225. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  226. \csname #1\endcsname\fi}
  227. % @end foo executes the definition of \Efoo.
  228. \def\end{\parsearg\endxxx}
  229. \def\endxxx #1{%
  230.   \removeactivespaces{#1}%
  231.   \edef\endthing{\the\toks0}%
  232.   \expandafter\ifx\csname E\endthing\endcsname\relax
  233.     \expandafter\ifx\csname \endthing\endcsname\relax
  234.       % There's no \foo, i.e., no ``environment'' foo.
  235.       \errhelp = \EMsimple
  236.       \errmessage{Undefined command `@end \endthing'}%
  237.     \else
  238.       \unmatchedenderror\endthing
  239.     \fi
  240.   \else
  241.     % Everything's ok; the right environment has been started.
  242.     \csname E\endthing\endcsname
  243.   \fi
  244. % There is an environment #1, but it hasn't been started.  Give an error.
  245. \def\unmatchedenderror#1{%
  246.   \errhelp = \EMsimple
  247.   \errmessage{This `@end #1' doesn't have a matching `@#1'}%
  248. % Define the control sequence \E#1 to give an unmatched @end error.
  249. \def\defineunmatchedend#1{%
  250.   \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
  251. % Single-spacing is done by various environments (specifically, in
  252. % \nonfillstart and \quotations).
  253. \newskip\singlespaceskip \singlespaceskip = 12.5pt
  254. \def\singlespace{%
  255.   % Why was this kern here?  It messes up equalizing space above and below
  256.   % environments.  --karl, 6may93
  257.   %{\advance \baselineskip by -\singlespaceskip
  258.   %\kern \baselineskip}%
  259.   \setleading \singlespaceskip
  260. %% Simple single-character @ commands
  261. % @@ prints an @
  262. % Kludge this until the fonts are right (grr).
  263. \def\@{{\tt \char '100}}
  264. % This is turned off because it was never documented
  265. % and you can use @w{...} around a quote to suppress ligatures.
  266. %% Define @` and @' to be the same as ` and '
  267. %% but suppressing ligatures.
  268. %\def\`{{`}}
  269. %\def\'{{'}}
  270. % Used to generate quoted braces.
  271. \def\mylbrace {{\tt \char '173}}
  272. \def\myrbrace {{\tt \char '175}}
  273. \let\{=\mylbrace
  274. \let\}=\myrbrace
  275. % @: forces normal size whitespace following.
  276. \def\:{\spacefactor=1000 }
  277. % @* forces a line break.
  278. \def\*{\hfil\break\hbox{}\ignorespaces}
  279. % @. is an end-of-sentence period.
  280. \def\.{.\spacefactor=3000 }
  281. % @w prevents a word break.  Without the \leavevmode, @w at the
  282. % beginning of a paragraph, when TeX is still in vertical mode, would
  283. % produce a whole line of output instead of starting the paragraph.
  284. \def\w#1{\leavevmode\hbox{#1}}
  285. % @group ... @end group forces ... to be all on one page, by enclosing
  286. % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
  287. % to keep its height that of a normal line.  According to the rules for
  288. % \topskip (p.114 of the TeXbook), the glue inserted is
  289. % max (\topskip - \ht (first item), 0).  If that height is large,
  290. % therefore, no glue is inserted, and the space between the headline and
  291. % the text is small, which looks bad.
  292. \def\group{\begingroup
  293.   \ifnum\catcode13=\active \else
  294.     \errhelp = \groupinvalidhelp
  295.     \errmessage{@group invalid in context where filling is enabled}%
  296.   \fi
  297.   % The \vtop we start below produces a box with normal height and large
  298.   % depth; thus, TeX puts \baselineskip glue before it, and (when the
  299.   % next line of text is done) \lineskip glue after it.  (See p.82 of
  300.   % the TeXbook.)  Thus, space below is not quite equal to space
  301.   % above.  But it's pretty close.
  302.   \def\Egroup{%
  303.     \egroup           % End the \vtop.
  304.     \endgroup         % End the \group.
  305.   \vtop\bgroup
  306.     % We have to put a strut on the last line in case the @group is in
  307.     % the midst of an example, rather than completely enclosing it.
  308.     % Otherwise, the interline space between the last line of the group
  309.     % and the first line afterwards is too small.  But we can't put the
  310.     % strut in \Egroup, since there it would be on a line by itself.
  311.     % Hence this just inserts a strut at the beginning of each line.
  312.     \everypar = {\strut}%
  313.     %
  314.     % Since we have a strut on every line, we don't need any of TeX's
  315.     % normal interline spacing.
  316.     \offinterlineskip
  317.     %
  318.     % OK, but now we have to do something about blank
  319.     % lines in the input in @example-like environments, which normally
  320.     % just turn into \lisppar, which will insert no space now that we've
  321.     % turned off the interline space.  Simplest is to make them be an
  322.     % empty paragraph.
  323.     \ifx\par\lisppar
  324.       \edef\par{\leavevmode \par}%
  325.       %
  326.       % Reset ^^M's definition to new definition of \par.
  327.       \obeylines
  328.     \fi
  329.     %
  330.     % Do @comment since we are called inside an environment such as
  331.     % @example, where each end-of-line in the input causes an
  332.     % end-of-line in the output.  We don't want the end-of-line after
  333.     % the `@group' to put extra space in the output.  Since @group
  334.     % should appear on a line by itself (according to the Texinfo
  335.     % manual), we don't worry about eating any user text.
  336.     \comment
  337. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  338. % message, so this ends up printing `@group can only ...'.
  339. \newhelp\groupinvalidhelp{%
  340. group can only be used in environments such as @example,^^J%
  341. where each line of input produces a line of output.}
  342. % @need space-in-mils
  343. % forces a page break if there is not space-in-mils remaining.
  344. \newdimen\mil  \mil=0.001in
  345. \def\need{\parsearg\needx}
  346. % Old definition--didn't work.
  347. %\def\needx #1{\par %
  348. %% This method tries to make TeX break the page naturally
  349. %% if the depth of the box does not fit.
  350. %{\baselineskip=0pt%
  351. %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
  352. %\prevdepth=-1000pt
  353. \def\needx#1{%
  354.   % Go into vertical mode, so we don't make a big box in the middle of a
  355.   % paragraph.
  356.   \par
  357.   % Don't add any leading before our big empty box, but allow a page
  358.   % break, since the best break might be right here.
  359.   \allowbreak
  360.   \nointerlineskip
  361.   \vtop to #1\mil{\vfil}%
  362.   % TeX does not even consider page breaks if a penalty added to the
  363.   % main vertical list is 10000 or more.  But in order to see if the
  364.   % empty box we just added fits on the page, we must make it consider
  365.   % page breaks.  On the other hand, we don't want to actually break the
  366.   % page after the empty box.  So we use a penalty of 9999.
  367.   % There is an extremely small chance that TeX will actually break the
  368.   % page at this \penalty, if there are no other feasible breakpoints in
  369.   % sight.  (If the user is using lots of big @group commands, which
  370.   % almost-but-not-quite fill up a page, TeX will have a hard time doing
  371.   % good page breaking, for example.)  However, I could not construct an
  372.   % example where a page broke at this \penalty; if it happens in a real
  373.   % document, then we can reconsider our strategy.
  374.   \penalty9999
  375.   % Back up by the size of the box, whether we did a page break or not.
  376.   \kern -#1\mil
  377.   % Do not allow a page break right after this kern.
  378.   \nobreak
  379. % @br   forces paragraph break
  380. \let\br = \par
  381. % @dots{}  output some dots
  382. \def\dots{$\ldots$}
  383. % @page    forces the start of a new page
  384. \def\page{\par\vfill\supereject}
  385. % @exdent text....
  386. % outputs text on separate line in roman font, starting at standard page margin
  387. % This records the amount of indent in the innermost environment.
  388. % That's how much \exdent should take out.
  389. \newskip\exdentamount
  390. % This defn is used inside fill environments such as @defun.
  391. \def\exdent{\parsearg\exdentyyy}
  392. \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
  393. % This defn is used inside nofill environments such as @example.
  394. \def\nofillexdent{\parsearg\nofillexdentyyy}
  395. \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
  396. \leftline{\hskip\leftskip{\rm#1}}}}
  397. %\hbox{{\rm#1}}\hfil\break}}
  398. % @include file    insert text of that file as input.
  399. \def\include{\parsearg\includezzz}
  400. %Use \input\thisfile to avoid blank after \input, which may be an active
  401. %char (in which case the blank would become the \input argument).
  402. %The grouping keeps the value of \thisfile correct even when @include
  403. %is nested.
  404. \def\includezzz #1{\begingroup
  405. \def\thisfile{#1}\input\thisfile
  406. \endgroup}
  407. \def\thisfile{}
  408. % @center line   outputs that line, centered
  409. \def\center{\parsearg\centerzzz}
  410. \def\centerzzz #1{{\advance\hsize by -\leftskip
  411. \advance\hsize by -\rightskip
  412. \centerline{#1}}}
  413. % @sp n   outputs n lines of vertical space
  414. \def\sp{\parsearg\spxxx}
  415. \def\spxxx #1{\par \vskip #1\baselineskip}
  416. % @comment ...line which is ignored...
  417. % @c is the same as @comment
  418. % @ignore ... @end ignore  is another way to write a comment
  419. \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
  420. \parsearg \commentxxx}
  421. \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
  422. \let\c=\comment
  423. % Prevent errors for section commands.
  424. % Used in @ignore and in failing conditionals.
  425. \def\ignoresections{%
  426. \let\chapter=\relax
  427. \let\unnumbered=\relax
  428. \let\top=\relax
  429. \let\unnumberedsec=\relax
  430. \let\unnumberedsection=\relax
  431. \let\unnumberedsubsec=\relax
  432. \let\unnumberedsubsection=\relax
  433. \let\unnumberedsubsubsec=\relax
  434. \let\unnumberedsubsubsection=\relax
  435. \let\section=\relax
  436. \let\subsec=\relax
  437. \let\subsubsec=\relax
  438. \let\subsection=\relax
  439. \let\subsubsection=\relax
  440. \let\appendix=\relax
  441. \let\appendixsec=\relax
  442. \let\appendixsection=\relax
  443. \let\appendixsubsec=\relax
  444. \let\appendixsubsection=\relax
  445. \let\appendixsubsubsec=\relax
  446. \let\appendixsubsubsection=\relax
  447. \let\contents=\relax
  448. \let\smallbook=\relax
  449. \let\titlepage=\relax
  450. % Used in nested conditionals, where we have to parse the Texinfo source
  451. % and so want to turn off most commands, in case they are used
  452. % incorrectly.
  453. \def\ignoremorecommands{%
  454.   \let\defcv = \relax
  455.   \let\deffn = \relax
  456.   \let\deffnx = \relax
  457.   \let\defindex = \relax
  458.   \let\defivar = \relax
  459.   \let\defmac = \relax
  460.   \let\defmethod = \relax
  461.   \let\defop = \relax
  462.   \let\defopt = \relax
  463.   \let\defspec = \relax
  464.   \let\deftp = \relax
  465.   \let\deftypefn = \relax
  466.   \let\deftypefun = \relax
  467.   \let\deftypevar = \relax
  468.   \let\deftypevr = \relax
  469.   \let\defun = \relax
  470.   \let\defvar = \relax
  471.   \let\defvr = \relax
  472.   \let\ref = \relax
  473.   \let\xref = \relax
  474.   \let\printindex = \relax
  475.   \let\pxref = \relax
  476.   \let\settitle = \relax
  477.   \let\include = \relax
  478.   \let\lowersections = \relax
  479.   \let\down = \relax
  480.   \let\raisesections = \relax
  481.   \let\up = \relax
  482.   \let\set = \relax
  483.   \let\clear = \relax
  484.   \let\item = \relax
  485.   \let\message = \relax
  486. % Ignore @ignore ... @end ignore.
  487. \def\ignore{\doignore{ignore}}
  488. % Also ignore @ifinfo, @menu, and @direntry text.
  489. \def\ifinfo{\doignore{ifinfo}}
  490. \def\menu{\doignore{menu}}
  491. \def\direntry{\doignore{direntry}}
  492. % Ignore text until a line `@end #1'.
  493. \def\doignore#1{\begingroup
  494.   % Don't complain about control sequences we have declared \outer.
  495.   \ignoresections
  496.   % Define a command to swallow text until we reach `@end #1'.
  497.   \long\def\doignoretext##1\end #1{\enddoignore}%
  498.   % Make sure that spaces turn into tokens that match what \doignoretext wants.
  499.   \catcode32 = 10
  500.   % And now expand that command.
  501.   \doignoretext
  502. % What we do to finish off ignored text.
  503. \def\enddoignore{\endgroup\ignorespaces}%
  504. \newif\ifwarnedobs\warnedobsfalse
  505. \def\obstexwarn{%
  506.   \ifwarnedobs\relax\else
  507.   % We need to warn folks that they may have trouble with TeX 3.0.
  508.   % This uses \immediate\write16 rather than \message to get newlines.
  509.     \immediate\write16{}
  510.     \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
  511.     \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
  512.     \immediate\write16{If you are running another version of TeX, relax.}
  513.     \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
  514.     \immediate\write16{  Then upgrade your TeX installation if you can.}
  515.     \immediate\write16{If you are stuck with version 3.0, run the}
  516.     \immediate\write16{  script ``tex3patch'' from the Texinfo distribution}
  517.     \immediate\write16{  to use a workaround.}
  518.     \immediate\write16{}
  519.     \warnedobstrue
  520.     \fi
  521. % **In TeX 3.0, setting text in \nullfont hangs tex.  For a
  522. % workaround (which requires the file ``dummy.tfm'' to be installed),
  523. % uncomment the following line:
  524. %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
  525. % Ignore text, except that we keep track of conditional commands for
  526. % purposes of nesting, up to an `@end #1' command.
  527. \def\nestedignore#1{%
  528.   \obstexwarn
  529.   % We must actually expand the ignored text to look for the @end
  530.   % command, so that nested ignore constructs work.  Thus, we put the
  531.   % text into a \vbox and then do nothing with the result.  To minimize
  532.   % the change of memory overflow, we follow the approach outlined on
  533.   % page 401 of the TeXbook: make the current font be a dummy font.
  534.   \setbox0 = \vbox\bgroup
  535.     % Don't complain about control sequences we have declared \outer.
  536.     \ignoresections
  537.     %
  538.     % Define `@end #1' to end the box, which will in turn undefine the
  539.     % @end command again.
  540.     \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
  541.     %
  542.     % We are going to be parsing Texinfo commands.  Most cause no
  543.     % trouble when they are used incorrectly, but some commands do
  544.     % complicated argument parsing or otherwise get confused, so we
  545.     % undefine them.
  546.     %
  547.     % We can't do anything about stray @-signs, unfortunately;
  548.     % they'll produce `undefined control sequence' errors.
  549.     \ignoremorecommands
  550.     %
  551.     % Set the current font to be \nullfont, a TeX primitive, and define
  552.     % all the font commands to also use \nullfont.  We don't use
  553.     % dummy.tfm, as suggested in the TeXbook, because not all sites
  554.     % might have that installed.  Therefore, math mode will still
  555.     % produce output, but that should be an extremely small amount of
  556.     % stuff compared to the main input.
  557.     %
  558.     \nullfont
  559.     \let\tenrm = \nullfont  \let\tenit = \nullfont  \let\tensl = \nullfont
  560.     \let\tenbf = \nullfont  \let\tentt = \nullfont  \let\smallcaps = \nullfont
  561.     \let\tensf = \nullfont
  562.     % Similarly for index fonts (mostly for their use in
  563.     % smallexample)
  564.     \let\indrm = \nullfont  \let\indit = \nullfont  \let\indsl = \nullfont
  565.     \let\indbf = \nullfont  \let\indtt = \nullfont  \let\indsc = \nullfont
  566.     \let\indsf = \nullfont
  567.     %
  568.     % Don't complain when characters are missing from the fonts.
  569.     \tracinglostchars = 0
  570.     %
  571.     % Don't bother to do space factor calculations.
  572.     \frenchspacing
  573.     %
  574.     % Don't report underfull hboxes.
  575.     \hbadness = 10000
  576.     %
  577.     % Do minimal line-breaking.
  578.     \pretolerance = 10000
  579.     %
  580.     % Do not execute instructions in @tex
  581.     \def\tex{\doignore{tex}}
  582. % @set VAR sets the variable VAR to an empty value.
  583. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  584. % Since we want to separate VAR from REST-OF-LINE (which might be
  585. % empty), we can't just use \parsearg; we have to insert a space of our
  586. % own to delimit the rest of the line, and then take it out again if we
  587. % didn't need it.
  588. \def\set{\parsearg\setxxx}
  589. \def\setxxx#1{\setyyy#1 \endsetyyy}
  590. \def\setyyy#1 #2\endsetyyy{%
  591.   \def\temp{#2}%
  592.   \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
  593.   \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
  594.   \fi
  595. \def\setzzz#1#2 \endsetzzz{\expandafter\xdef\csname SET#1\endcsname{#2}}
  596. % @clear VAR clears (i.e., unsets) the variable VAR.
  597. \def\clear{\parsearg\clearxxx}
  598. \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
  599. % @value{foo} gets the text saved in variable foo.
  600. \def\value#1{\expandafter
  601.         \ifx\csname SET#1\endcsname\relax
  602.             {\{No value for ``#1''\}}
  603.         \else \csname SET#1\endcsname \fi}
  604. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  605. % with @set.
  606. \def\ifset{\parsearg\ifsetxxx}
  607. \def\ifsetxxx #1{%
  608.   \expandafter\ifx\csname SET#1\endcsname\relax
  609.     \expandafter\ifsetfail
  610.   \else
  611.     \expandafter\ifsetsucceed
  612.   \fi
  613. \def\ifsetsucceed{\conditionalsucceed{ifset}}
  614. \def\ifsetfail{\nestedignore{ifset}}
  615. \defineunmatchedend{ifset}
  616. % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
  617. % defined with @set, or has been undefined with @clear.
  618. \def\ifclear{\parsearg\ifclearxxx}
  619. \def\ifclearxxx #1{%
  620.   \expandafter\ifx\csname SET#1\endcsname\relax
  621.     \expandafter\ifclearsucceed
  622.   \else
  623.     \expandafter\ifclearfail
  624.   \fi
  625. \def\ifclearsucceed{\conditionalsucceed{ifclear}}
  626. \def\ifclearfail{\nestedignore{ifclear}}
  627. \defineunmatchedend{ifclear}
  628. % @iftex always succeeds; we read the text following, through @end
  629. % iftex).  But `@end iftex' should be valid only after an @iftex.
  630. \def\iftex{\conditionalsucceed{iftex}}
  631. \defineunmatchedend{iftex}
  632. % We can't just want to start a group at @iftex (for example) and end it
  633. % at @end iftex, since then @set commands inside the conditional have no
  634. % effect (they'd get reverted at the end of the group).  So we must
  635. % define \Eiftex to redefine itself to be its previous value.  (We can't
  636. % just define it to fail again with an ``unmatched end'' error, since
  637. % the @ifset might be nested.)
  638. \def\conditionalsucceed#1{%
  639.   \edef\temp{%
  640.     % Remember the current value of \E#1.
  641.     \let\nece{prevE#1} = \nece{E#1}%
  642.     %
  643.     % At the `@end #1', redefine \E#1 to be its previous value.
  644.     \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
  645.   \temp
  646. % We need to expand lots of \csname's, but we don't want to expand the
  647. % control sequences after we've constructed them.
  648. \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
  649. % @asis just yields its argument.  Used with @table, for example.
  650. \def\asis#1{#1}
  651. % @math means output in math mode.
  652. % We don't use $'s directly in the definition of \math because control
  653. % sequences like \math are expanded when the toc file is written.  Then,
  654. % we read the toc file back, the $'s will be normal characters (as they
  655. % should be, according to the definition of Texinfo).  So we must use a
  656. % control sequence to switch into and out of math mode.
  657. % This isn't quite enough for @math to work properly in indices, but it
  658. % seems unlikely it will ever be needed there.
  659. \let\implicitmath = $
  660. \def\math#1{\implicitmath #1\implicitmath}
  661. % @bullet and @minus need the same treatment as @math, just above.
  662. \def\bullet{\implicitmath\ptexbullet\implicitmath}
  663. \def\minus{\implicitmath-\implicitmath}
  664. \def\node{\ENVcheck\parsearg\nodezzz}
  665. \def\nodezzz#1{\nodexxx [#1,]}
  666. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  667. \let\nwnode=\node
  668. \let\lastnode=\relax
  669. \def\donoderef{\ifx\lastnode\relax\else
  670. \expandafter\expandafter\expandafter\setref{\lastnode}\fi
  671. \global\let\lastnode=\relax}
  672. \def\unnumbnoderef{\ifx\lastnode\relax\else
  673. \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
  674. \global\let\lastnode=\relax}
  675. \def\appendixnoderef{\ifx\lastnode\relax\else
  676. \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
  677. \global\let\lastnode=\relax}
  678. \let\refill=\relax
  679. % @setfilename is done at the beginning of every texinfo file.
  680. % So open here the files we need to have open while reading the input.
  681. % This makes it possible to make a .fmt file for texinfo.
  682. \def\setfilename{%
  683.    \readauxfile
  684.    \opencontents
  685.    \openindices
  686.    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  687.    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  688.    \comment % Ignore the actual filename.
  689. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  690. \def\inforef #1{\inforefzzz #1,,,,**}
  691. \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  692.   node \samp{\ignorespaces#1{}}}
  693. \message{fonts,}
  694. % Font-change commands.
  695. % Texinfo supports the sans serif font style, which plain TeX does not.
  696. % So we set up a \sf analogous to plain's \rm, etc.
  697. \newfam\sffam
  698. \def\sf{\fam=\sffam \tensf}
  699. \let\li = \sf % Sometimes we call it \li, not \sf.
  700. %% Try out Computer Modern fonts at \magstephalf
  701. \let\mainmagstep=\magstephalf
  702. \ifx\bigger\relax
  703. \let\mainmagstep=\magstep1
  704. \font\textrm=cmr12
  705. \font\texttt=cmtt12
  706. \else
  707. \font\textrm=cmr10 scaled \mainmagstep
  708. \font\texttt=cmtt10 scaled \mainmagstep
  709. % Instead of cmb10, you many want to use cmbx10.
  710. % cmbx10 is a prettier font on its own, but cmb10
  711. % looks better when embedded in a line with cmr10.
  712. \font\textbf=cmb10 scaled \mainmagstep
  713. \font\textit=cmti10 scaled \mainmagstep
  714. \font\textsl=cmsl10 scaled \mainmagstep
  715. \font\textsf=cmss10 scaled \mainmagstep
  716. \font\textsc=cmcsc10 scaled \mainmagstep
  717. \font\texti=cmmi10 scaled \mainmagstep
  718. \font\textsy=cmsy10 scaled \mainmagstep
  719. % A few fonts for @defun, etc.
  720. \font\defbf=cmbx10 scaled \magstep1 %was 1314
  721. \font\deftt=cmtt10 scaled \magstep1
  722. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  723. % Fonts for indices and small examples.
  724. % We actually use the slanted font rather than the italic,
  725. % because texinfo normally uses the slanted fonts for that.
  726. % Do not make many font distinctions in general in the index, since they
  727. % aren't very useful.
  728. \font\ninett=cmtt9
  729. \font\indrm=cmr9
  730. \font\indit=cmsl9
  731. \let\indsl=\indit
  732. \let\indtt=\ninett
  733. \let\indsf=\indrm
  734. \let\indbf=\indrm
  735. \let\indsc=\indrm
  736. \font\indi=cmmi9
  737. \font\indsy=cmsy9
  738. % Fonts for headings
  739. \font\chaprm=cmbx12 scaled \magstep2
  740. \font\chapit=cmti12 scaled \magstep2
  741. \font\chapsl=cmsl12 scaled \magstep2
  742. \font\chaptt=cmtt12 scaled \magstep2
  743. \font\chapsf=cmss12 scaled \magstep2
  744. \let\chapbf=\chaprm
  745. \font\chapsc=cmcsc10 scaled\magstep3
  746. \font\chapi=cmmi12 scaled \magstep2
  747. \font\chapsy=cmsy10 scaled \magstep3
  748. \font\secrm=cmbx12 scaled \magstep1
  749. \font\secit=cmti12 scaled \magstep1
  750. \font\secsl=cmsl12 scaled \magstep1
  751. \font\sectt=cmtt12 scaled \magstep1
  752. \font\secsf=cmss12 scaled \magstep1
  753. \font\secbf=cmbx12 scaled \magstep1
  754. \font\secsc=cmcsc10 scaled\magstep2
  755. \font\seci=cmmi12 scaled \magstep1
  756. \font\secsy=cmsy10 scaled \magstep2
  757. % \font\ssecrm=cmbx10 scaled \magstep1    % This size an font looked bad.
  758. % \font\ssecit=cmti10 scaled \magstep1    % The letters were too crowded.
  759. % \font\ssecsl=cmsl10 scaled \magstep1
  760. % \font\ssectt=cmtt10 scaled \magstep1
  761. % \font\ssecsf=cmss10 scaled \magstep1
  762. %\font\ssecrm=cmb10 scaled 1315    % Note the use of cmb rather than cmbx.
  763. %\font\ssecit=cmti10 scaled 1315    % Also, the size is a little larger than
  764. %\font\ssecsl=cmsl10 scaled 1315    % being scaled magstep1.
  765. %\font\ssectt=cmtt10 scaled 1315
  766. %\font\ssecsf=cmss10 scaled 1315
  767. %\let\ssecbf=\ssecrm
  768. \font\ssecrm=cmbx12 scaled \magstephalf
  769. \font\ssecit=cmti12 scaled \magstephalf
  770. \font\ssecsl=cmsl12 scaled \magstephalf
  771. \font\ssectt=cmtt12 scaled \magstephalf
  772. \font\ssecsf=cmss12 scaled \magstephalf
  773. \font\ssecbf=cmbx12 scaled \magstephalf
  774. \font\ssecsc=cmcsc10 scaled \magstep1
  775. \font\sseci=cmmi12 scaled \magstephalf
  776. \font\ssecsy=cmsy10 scaled \magstep1
  777. % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  778. % but that is not a standard magnification.
  779. % Fonts for title page:
  780. \font\titlerm = cmbx12 scaled \magstep3
  781. \let\authorrm = \secrm
  782. % In order for the font changes to affect most math symbols and letters,
  783. % we have to define the \textfont of the standard families.  Since
  784. % texinfo doesn't allow for producing subscripts and superscripts, we
  785. % don't bother to reset \scriptfont and \scriptscriptfont (which would
  786. % also require loading a lot more fonts).
  787. \def\resetmathfonts{%
  788.   \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
  789.   \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
  790.   \textfont\ttfam = \tentt \textfont\sffam = \tensf
  791. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  792. % of just \STYLE.  We do this so that font changes will continue to work
  793. % in math mode, where it is the current \fam that is relevant in most
  794. % cases, not the current.  Plain TeX does, for example,
  795. % \def\bf{\fam=\bffam \tenbf}  By redefining \tenbf, we obviate the need
  796. % to redefine \bf itself.
  797. \def\textfonts{%
  798.   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  799.   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  800.   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
  801.   \resetmathfonts}
  802. \def\chapfonts{%
  803.   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
  804.   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  805.   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
  806.   \resetmathfonts}
  807. \def\secfonts{%
  808.   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  809.   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  810.   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
  811.   \resetmathfonts}
  812. \def\subsecfonts{%
  813.   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  814.   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  815.   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
  816.   \resetmathfonts}
  817. \def\indexfonts{%
  818.   \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
  819.   \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
  820.   \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
  821.   \resetmathfonts}
  822. % Set up the default fonts, so we can use them for creating boxes.
  823. \textfonts
  824. % Count depth in font-changes, for error checks
  825. \newcount\fontdepth \fontdepth=0
  826. % Fonts for short table of contents.
  827. \font\shortcontrm=cmr12
  828. \font\shortcontbf=cmbx12
  829. \font\shortcontsl=cmsl12
  830. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  831. %% serif) and @ii for TeX italic
  832. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  833. % unless the following character is such as not to need one.
  834. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  835. \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
  836. \let\i=\smartitalic
  837. \let\var=\smartitalic
  838. \let\dfn=\smartitalic
  839. \let\emph=\smartitalic
  840. \let\cite=\smartitalic
  841. \def\b#1{{\bf #1}}
  842. \let\strong=\b
  843. % We can't just use \exhyphenpenalty, because that only has effect at
  844. % the end of a paragraph.  Restore normal hyphenation at the end of the
  845. % group within which \nohyphenation is presumably called.
  846. \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
  847. \def\restorehyphenation{\hyphenchar\font = `- }
  848. \def\t#1{%
  849.   {\tt \nohyphenation \rawbackslash \frenchspacing #1}%
  850.   \null
  851. \let\ttfont = \t
  852. %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
  853. \def\samp #1{`\tclose{#1}'\null}
  854. \def\key #1{{\tt \nohyphenation \uppercase{#1}}\null}
  855. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  856. \let\file=\samp
  857. % @code is a modification of @t,
  858. % which makes spaces the same size as normal in the surrounding text.
  859. \def\tclose#1{%
  860.     % Change normal interword space to be same as for the current font.
  861.     \spaceskip = \fontdimen2\font
  862.     %
  863.     % Switch to typewriter.
  864.     \tt
  865.     %
  866.     % But `\ ' produces the large typewriter interword space.
  867.     \def\ {{\spaceskip = 0pt{} }}%
  868.     %
  869.     % Turn off hyphenation.
  870.     \nohyphenation
  871.     %
  872.     \rawbackslash
  873.     \frenchspacing
  874.     #1%
  875.   \null
  876. % We *must* turn on hyphenation at `-' and `_' in \code.
  877. % Otherwise, it is too hard to avoid overful hboxes
  878. % in the Emacs manual, the Library manual, etc.
  879. % Unfortunately, TeX uses one parameter (\hyphenchar) to control
  880. % both hyphenation at - and hyphenation within words.
  881. % We must therefore turn them both off (\tclose does that)
  882. % and arrange explicitly to hyphenate an a dash.
  883. %  -- rms.
  884. \catcode`\-=\active
  885. \catcode`\_=\active
  886. \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
  887. % The following is used by \doprintindex to insure that long function names
  888. % wrap around.  It is necessary for - and _ to be active before the index is
  889. % read from the file, as \entry parses the arguments long before \code is
  890. % ever called.  -- mycroft
  891. \global\def\indexbreaks{\catcode`\-=\active \let-\realdash \catcode`\_=\active \let_\realunder}
  892. \def\realdash{-}
  893. \def\realunder{_}
  894. \def\codedash{-\discretionary{}{}{}}
  895. \def\codeunder{\normalunderscore\discretionary{}{}{}}
  896. \def\codex #1{\tclose{#1}\endgroup}
  897. %\let\exp=\tclose  %Was temporary
  898. % @kbd is like @code, except that if the argument is just one @key command,
  899. % then @kbd has no effect.
  900. \def\xkey{\key}
  901. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  902. \ifx\one\xkey\ifx\threex\three \key{#2}%
  903. \else\tclose{\look}\fi
  904. \else\tclose{\look}\fi}
  905. % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
  906. % argument is to make the input look right: @dmn{pt} instead of
  907. % @dmn{}pt.
  908. \def\dmn#1{\thinspace #1}
  909. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  910. \def\l#1{{\li #1}\null}        %
  911. \def\r#1{{\rm #1}}        % roman font
  912. % Use of \lowercase was suggested.
  913. \def\sc#1{{\smallcaps#1}}    % smallcaps font
  914. \def\ii#1{{\it #1}}        % italic font
  915. \message{page headings,}
  916. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  917. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  918. % First the title page.  Must do @settitle before @titlepage.
  919. \def\titlefont#1{{\titlerm #1}}
  920. \newif\ifseenauthor
  921. \newif\iffinishedtitlepage
  922. \def\shorttitlepage{\parsearg\shorttitlepagezzz}
  923. \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  924.     \endgroup\page\hbox{}\page}
  925. \def\titlepage{\begingroup \parindent=0pt \textfonts
  926.    \let\subtitlerm=\tenrm
  927. % I deinstalled the following change because \cmr12 is undefined.
  928. % This change was not in the ChangeLog anyway.  --rms.
  929. %   \let\subtitlerm=\cmr12
  930.    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  931.    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  932.    % Leave some space at the very top of the page.
  933.    \vglue\titlepagetopglue
  934.    % Now you can print the title using @title.
  935.    \def\title{\parsearg\titlezzz}%
  936.    \def\titlezzz##1{\leftline{\titlefont{##1}}
  937.             % print a rule at the page bottom also.
  938.             \finishedtitlepagefalse
  939.             \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
  940.    % No rule at page bottom unless we print one at the top with @title.
  941.    \finishedtitlepagetrue
  942.    % Now you can put text using @subtitle.
  943.    \def\subtitle{\parsearg\subtitlezzz}%
  944.    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  945.    % @author should come last, but may come many times.
  946.    \def\author{\parsearg\authorzzz}%
  947.    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  948.       {\authorfont \leftline{##1}}}%
  949.    % Most title ``pages'' are actually two pages long, with space
  950.    % at the top of the second.  We don't want the ragged left on the second.
  951.    \let\oldpage = \page
  952.    \def\page{%
  953.       \iffinishedtitlepage\else
  954.      \finishtitlepage
  955.       \fi
  956.       \oldpage
  957.       \let\page = \oldpage
  958.       \hbox{}}%
  959. %   \def\page{\oldpage \hbox{}}
  960. \def\Etitlepage{%
  961.    \iffinishedtitlepage\else
  962.       \finishtitlepage
  963.    \fi
  964.    % It is important to do the page break before ending the group,
  965.    % because the headline and footline are only empty inside the group.
  966.    % If we use the new definition of \page, we always get a blank page
  967.    % after the title page, which we certainly don't want.
  968.    \oldpage
  969.    \endgroup
  970.    \HEADINGSon
  971. \def\finishtitlepage{%
  972.    \vskip4pt \hrule height 2pt width \hsize
  973.    \vskip\titlepagebottomglue
  974.    \finishedtitlepagetrue
  975. %%% Set up page headings and footings.
  976. \let\thispage=\folio
  977. \newtoks \evenheadline    % Token sequence for heading line of even pages
  978. \newtoks \oddheadline     % Token sequence for heading line of odd pages
  979. \newtoks \evenfootline    % Token sequence for footing line of even pages
  980. \newtoks \oddfootline     % Token sequence for footing line of odd pages
  981. % Now make Tex use those variables
  982. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  983.                             \else \the\evenheadline \fi}}
  984. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  985.                             \else \the\evenfootline \fi}\HEADINGShook}
  986. \let\HEADINGShook=\relax
  987. % Commands to set those variables.
  988. % For example, this is what  @headings on  does
  989. % @evenheading @thistitle|@thispage|@thischapter
  990. % @oddheading @thischapter|@thispage|@thistitle
  991. % @evenfooting @thisfile||
  992. % @oddfooting ||@thisfile
  993. \def\evenheading{\parsearg\evenheadingxxx}
  994. \def\oddheading{\parsearg\oddheadingxxx}
  995. \def\everyheading{\parsearg\everyheadingxxx}
  996. \def\evenfooting{\parsearg\evenfootingxxx}
  997. \def\oddfooting{\parsearg\oddfootingxxx}
  998. \def\everyfooting{\parsearg\everyfootingxxx}
  999. {\catcode`\@=0 %
  1000. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  1001. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  1002. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1003. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  1004. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  1005. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1006. \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
  1007. \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
  1008. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  1009. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1010. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  1011. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  1012. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1013. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  1014. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  1015. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1016. \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
  1017. \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
  1018. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  1019. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1020. }% unbind the catcode of @.
  1021. % @headings double    turns headings on for double-sided printing.
  1022. % @headings single    turns headings on for single-sided printing.
  1023. % @headings off        turns them off.
  1024. % @headings on        same as @headings double, retained for compatibility.
  1025. % @headings after    turns on double-sided headings after this page.
  1026. % @headings doubleafter    turns on double-sided headings after this page.
  1027. % @headings singleafter turns on single-sided headings after this page.
  1028. % By default, they are off.
  1029. \def\headings #1 {\csname HEADINGS#1\endcsname}
  1030. \def\HEADINGSoff{
  1031. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  1032. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  1033. \HEADINGSoff
  1034. % When we turn headings on, set the page number to 1.
  1035. % For double-sided printing, put current file name in lower left corner,
  1036. % chapter name on inside top of right hand pages, document
  1037. % title on inside top of left hand pages, and page numbers on outside top
  1038. % edge of all pages.
  1039. \def\HEADINGSdouble{
  1040. %\pagealignmacro
  1041. \global\pageno=1
  1042. \global\evenfootline={\hfil}
  1043. \global\oddfootline={\hfil}
  1044. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1045. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1046. % For single-sided printing, chapter title goes across top left of page,
  1047. % page number on top right.
  1048. \def\HEADINGSsingle{
  1049. %\pagealignmacro
  1050. \global\pageno=1
  1051. \global\evenfootline={\hfil}
  1052. \global\oddfootline={\hfil}
  1053. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1054. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1055. \def\HEADINGSon{\HEADINGSdouble}
  1056. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  1057. \let\HEADINGSdoubleafter=\HEADINGSafter
  1058. \def\HEADINGSdoublex{%
  1059. \global\evenfootline={\hfil}
  1060. \global\oddfootline={\hfil}
  1061. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1062. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1063. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  1064. \def\HEADINGSsinglex{%
  1065. \global\evenfootline={\hfil}
  1066. \global\oddfootline={\hfil}
  1067. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1068. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1069. % Subroutines used in generating headings
  1070. % Produces Day Month Year style of output.
  1071. \def\today{\number\day\space
  1072. \ifcase\month\or
  1073. January\or February\or March\or April\or May\or June\or
  1074. July\or August\or September\or October\or November\or December\fi
  1075. \space\number\year}
  1076. % Use this if you want the Month Day, Year style of output.
  1077. %\def\today{\ifcase\month\or
  1078. %January\or February\or March\or April\or May\or June\or
  1079. %July\or August\or September\or October\or November\or December\fi
  1080. %\space\number\day, \number\year}
  1081. % @settitle line...  specifies the title of the document, for headings
  1082. % It generates no output of its own
  1083. \def\thistitle{No Title}
  1084. \def\settitle{\parsearg\settitlezzz}
  1085. \def\settitlezzz #1{\gdef\thistitle{#1}}
  1086. \message{tables,}
  1087. % @tabs -- simple alignment
  1088. % These don't work.  For one thing, \+ is defined as outer.
  1089. % So these macros cannot even be defined.
  1090. %\def\tabs{\parsearg\tabszzz}
  1091. %\def\tabszzz #1{\settabs\+#1\cr}
  1092. %\def\tabline{\parsearg\tablinezzz}
  1093. %\def\tablinezzz #1{\+#1\cr}
  1094. %\def\&{&}
  1095. % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
  1096. % default indentation of table text
  1097. \newdimen\tableindent \tableindent=.8in
  1098. % default indentation of @itemize and @enumerate text
  1099. \newdimen\itemindent  \itemindent=.3in
  1100. % margin between end of table item and start of table text.
  1101. \newdimen\itemmargin  \itemmargin=.1in
  1102. % used internally for \itemindent minus \itemmargin
  1103. \newdimen\itemmax
  1104. % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
  1105. % these defs.
  1106. % They also define \itemindex
  1107. % to index the item name in whatever manner is desired (perhaps none).
  1108. \newif\ifitemxneedsnegativevskip
  1109. \def\itemxpar{\par\ifitemxneedsnegativevskip\vskip-\parskip\nobreak\fi}
  1110. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  1111. \def\internalBitemx{\itemxpar \parsearg\itemzzz}
  1112. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  1113. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
  1114. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  1115. \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
  1116. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  1117.                  \itemzzz {#1}}
  1118. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  1119.                  \itemzzz {#1}}
  1120. \def\itemzzz #1{\begingroup %
  1121.   \advance\hsize by -\rightskip
  1122.   \advance\hsize by -\tableindent
  1123.   \setbox0=\hbox{\itemfont{#1}}%
  1124.   \itemindex{#1}%
  1125.   \nobreak % This prevents a break before @itemx.
  1126.   % Be sure we are not still in the middle of a paragraph.
  1127.   %{\parskip = 0in
  1128.   %\par
  1129.   %}%
  1130.   % If the item text does not fit in the space we have, put it on a line
  1131.   % by itself, and do not allow a page break either before or after that
  1132.   % line.  We do not start a paragraph here because then if the next
  1133.   % command is, e.g., @kindex, the whatsit would get put into the
  1134.   % horizontal list on a line by itself, resulting in extra blank space.
  1135.   \ifdim \wd0>\itemmax
  1136.     %
  1137.     % Make this a paragraph so we get the \parskip glue and wrapping,
  1138.     % but leave it ragged-right.
  1139.     \begingroup
  1140.       \advance\leftskip by-\tableindent
  1141.       \advance\hsize by\tableindent
  1142.       \advance\rightskip by0pt plus1fil
  1143.       \leavevmode\unhbox0\par
  1144.     \endgroup
  1145.     %
  1146.     % We're going to be starting a paragraph, but we don't want the
  1147.     % \parskip glue -- logically it's part of the @item we just started.
  1148.     \nobreak \vskip-\parskip
  1149.     %
  1150.     % Stop a page break at the \parskip glue coming up.  Unfortunately
  1151.     % we can't prevent a possible page break at the following
  1152.     % \baselineskip glue.
  1153.     \nobreak
  1154.     \endgroup
  1155.     \itemxneedsnegativevskipfalse
  1156.   \else
  1157.     % The item text fits into the space.  Start a paragraph, so that the
  1158.     % following text (if any) will end up on the same line.  Since that
  1159.     % text will be indented by \tableindent, we make the item text be in
  1160.     % a zero-width box.
  1161.     \noindent
  1162.     \rlap{\hskip -\tableindent\box0}\ignorespaces%
  1163.     \endgroup%
  1164.     \itemxneedsnegativevskiptrue%
  1165.   \fi
  1166. \def\item{\errmessage{@item while not in a table}}
  1167. \def\itemx{\errmessage{@itemx while not in a table}}
  1168. \def\kitem{\errmessage{@kitem while not in a table}}
  1169. \def\kitemx{\errmessage{@kitemx while not in a table}}
  1170. \def\xitem{\errmessage{@xitem while not in a table}}
  1171. \def\xitemx{\errmessage{@xitemx while not in a table}}
  1172. %% Contains a kludge to get @end[description] to work
  1173. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  1174. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  1175. {\obeylines\obeyspaces%
  1176. \gdef\tablex #1^^M{%
  1177. \tabley\dontindex#1        \endtabley}}
  1178. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  1179. {\obeylines\obeyspaces%
  1180. \gdef\ftablex #1^^M{%
  1181. \tabley\fnitemindex#1        \endtabley
  1182. \def\Eftable{\endgraf\afterenvbreak\endgroup}%
  1183. \let\Etable=\relax}}
  1184. \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
  1185. {\obeylines\obeyspaces%
  1186. \gdef\vtablex #1^^M{%
  1187. \tabley\vritemindex#1        \endtabley
  1188. \def\Evtable{\endgraf\afterenvbreak\endgroup}%
  1189. \let\Etable=\relax}}
  1190. \def\dontindex #1{}
  1191. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  1192. \def\vritemindex #1{\doind {vr}{\code{#1}}}%
  1193. {\obeyspaces %
  1194. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  1195. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  1196. \def\tablez #1#2#3#4#5#6{%
  1197. \aboveenvbreak %
  1198. \begingroup %
  1199. \def\Edescription{\Etable}% Neccessary kludge.
  1200. \let\itemindex=#1%
  1201. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  1202. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  1203. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  1204. \def\itemfont{#2}%
  1205. \itemmax=\tableindent %
  1206. \advance \itemmax by -\itemmargin %
  1207. \advance \leftskip by \tableindent %
  1208. \exdentamount=\tableindent
  1209. \parindent = 0pt
  1210. \parskip = \smallskipamount
  1211. \ifdim \parskip=0pt \parskip=2pt \fi%
  1212. \def\Etable{\endgraf\afterenvbreak\endgroup}%
  1213. \let\item = \internalBitem %
  1214. \let\itemx = \internalBitemx %
  1215. \let\kitem = \internalBkitem %
  1216. \let\kitemx = \internalBkitemx %
  1217. \let\xitem = \internalBxitem %
  1218. \let\xitemx = \internalBxitemx %
  1219. % This is the counter used by @enumerate, which is really @itemize
  1220. \newcount \itemno
  1221. \def\itemize{\parsearg\itemizezzz}
  1222. \def\itemizezzz #1{%
  1223.   \begingroup % ended by the @end itemsize
  1224.   \itemizey {#1}{\Eitemize}
  1225. \def\itemizey #1#2{%
  1226. \aboveenvbreak %
  1227. \itemmax=\itemindent %
  1228. \advance \itemmax by -\itemmargin %
  1229. \advance \leftskip by \itemindent %
  1230. \exdentamount=\itemindent
  1231. \parindent = 0pt %
  1232. \parskip = \smallskipamount %
  1233. \ifdim \parskip=0pt \parskip=2pt \fi%
  1234. \def#2{\endgraf\afterenvbreak\endgroup}%
  1235. \def\itemcontents{#1}%
  1236. \let\item=\itemizeitem}
  1237. % Set sfcode to normal for the chars that usually have another value.
  1238. % These are `.?!:;,'
  1239. \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  1240.   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  1241. % \splitoff TOKENS\endmark defines \first to be the first token in
  1242. % TOKENS, and \rest to be the remainder.
  1243. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  1244. % Allow an optional argument of an uppercase letter, lowercase letter,
  1245. % or number, to specify the first label in the enumerated list.  No
  1246. % argument is the same as `1'.
  1247. \def\enumerate{\parsearg\enumeratezzz}
  1248. \def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
  1249. \def\enumeratey #1 #2\endenumeratey{%
  1250.   \begingroup % ended by the @end enumerate
  1251.   % If we were given no argument, pretend we were given `1'.
  1252.   \def\thearg{#1}%
  1253.   \ifx\thearg\empty \def\thearg{1}\fi
  1254.   % Detect if the argument is a single token.  If so, it might be a
  1255.   % letter.  Otherwise, the only valid thing it can be is a number.
  1256.   % (We will always have one token, because of the test we just made.
  1257.   % This is a good thing, since \splitoff doesn't work given nothing at
  1258.   % all -- the first parameter is undelimited.)
  1259.   \expandafter\splitoff\thearg\endmark
  1260.   \ifx\rest\empty
  1261.     % Only one token in the argument.  It could still be anything.
  1262.     % A ``lowercase letter'' is one whose \lccode is nonzero.
  1263.     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  1264.     %   not equal to itself.
  1265.     % Otherwise, we assume it's a number.
  1266.     %
  1267.     % We need the \relax at the end of the \ifnum lines to stop TeX from
  1268.     % continuing to look for a <number>.
  1269.     %
  1270.     \ifnum\lccode\expandafter`\thearg=0\relax
  1271.       \numericenumerate % a number (we hope)
  1272.     \else
  1273.       % It's a letter.
  1274.       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  1275.         \lowercaseenumerate % lowercase letter
  1276.       \else
  1277.         \uppercaseenumerate % uppercase letter
  1278.       \fi
  1279.     \fi
  1280.   \else
  1281.     % Multiple tokens in the argument.  We hope it's a number.
  1282.     \numericenumerate
  1283.   \fi
  1284. % An @enumerate whose labels are integers.  The starting integer is
  1285. % given in \thearg.
  1286. \def\numericenumerate{%
  1287.   \itemno = \thearg
  1288.   \startenumeration{\the\itemno}%
  1289. % The starting (lowercase) letter is in \thearg.
  1290. \def\lowercaseenumerate{%
  1291.   \itemno = \expandafter`\thearg
  1292.   \startenumeration{%
  1293.     % Be sure we're not beyond the end of the alphabet.
  1294.     \ifnum\itemno=0
  1295.       \errmessage{No more lowercase letters in @enumerate; get a bigger
  1296.                   alphabet}%
  1297.     \fi
  1298.     \char\lccode\itemno
  1299. % The starting (uppercase) letter is in \thearg.
  1300. \def\uppercaseenumerate{%
  1301.   \itemno = \expandafter`\thearg
  1302.   \startenumeration{%
  1303.     % Be sure we're not beyond the end of the alphabet.
  1304.     \ifnum\itemno=0
  1305.       \errmessage{No more uppercase letters in @enumerate; get a bigger
  1306.                   alphabet}
  1307.     \fi
  1308.     \char\uccode\itemno
  1309. % Call itemizey, adding a period to the first argument and supplying the
  1310. % common last two arguments.  Also subtract one from the initial value in
  1311. % \itemno, since @item increments \itemno.
  1312. \def\startenumeration#1{%
  1313.   \advance\itemno by -1
  1314.   \itemizey{#1.}\Eenumerate\flushcr
  1315. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  1316. % to @enumerate.
  1317. \def\alphaenumerate{\enumerate{a}}
  1318. \def\capsenumerate{\enumerate{A}}
  1319. \def\Ealphaenumerate{\Eenumerate}
  1320. \def\Ecapsenumerate{\Eenumerate}
  1321. % Definition of @item while inside @itemize.
  1322. \def\itemizeitem{%
  1323. \advance\itemno by 1
  1324. {\let\par=\endgraf \smallbreak}%
  1325. \ifhmode \errmessage{\in hmode at itemizeitem}\fi
  1326. {\parskip=0in \hskip 0pt
  1327. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  1328. \vadjust{\penalty 1200}}%
  1329. \flushcr}
  1330. % @multitable macros
  1331. % Amy Hendrickson, 8/18/94
  1332. % @multitable ... @endmultitable will make as many columns as desired.
  1333. % Contents of each column will wrap at width given in preamble. Width
  1334. % can be specified either with sample text given in a template line,
  1335. % or in percent of \hsize, the current width of text on page.
  1336. % Table can continue over pages but will only break between lines.
  1337. % To make preamble:
  1338. % Either define widths of columns in terms of percent of \hsize: 
  1339. %   @multitable @percentofhsize .2 .3 .5
  1340. %   @item ...
  1341. %   Numbers following @percentofhsize are the percent of the total
  1342. %   current hsize to be used for each column. You may use as many
  1343. %   columns as desired.
  1344. % Or use a template:
  1345. %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  1346. %   @item ...
  1347. %   using the widest term desired in each column.
  1348. % Each new table line starts with @item, each subsequent new column 
  1349. % starts with @tab. Empty columns may be produced by supplying @tab's
  1350. % with nothing between them for as many times as empty columns are needed,
  1351. % ie, @tab@tab@tab will produce two empty columns.
  1352. % @item, @tab, @multicolumn or @endmulticolumn do not need to be on their
  1353. % own lines, but it will not hurt if they are.
  1354. % Sample multitable:
  1355. %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  1356. %   @item first col stuff @tab second col stuff @tab third col
  1357. %   @item 
  1358. %   first col stuff 
  1359. %   @tab 
  1360. %   second col stuff 
  1361. %   @tab 
  1362. %   third col 
  1363. %   @item first col stuff @tab second col stuff 
  1364. %   @tab Many paragraphs of text may be used in any column.
  1365. %     
  1366. %         They will wrap at the width determined by the template.
  1367. %   @item@tab@tab This will be in third column.
  1368. %   @endmultitable
  1369. % Default dimensions may be reset by user.
  1370. % @intableparskip will set vertical space between paragraphs in table.
  1371. % @intableparindent will set paragraph indent in table.
  1372. % @spacebetweencols will set horizontal space to be left between columns.
  1373. % @spacebetweenlines will set vertical space to be left between lines.
  1374. % Dimensions 
  1375. \newdimen\intableparskip
  1376. \newdimen\intableparindent
  1377. \newdimen\spacebetweencols
  1378. \newdimen\spacebetweenlines
  1379. \intableparskip=0pt
  1380. \intableparindent=6pt
  1381. \spacebetweencols=12pt
  1382. \spacebetweenlines=12pt
  1383. % Macros used to set up halign preamble:
  1384. \let\endsetuptable\relax
  1385. \def\xendsetuptable{\endsetuptable}
  1386. \let\percentofhsize\relax
  1387. \def\xpercentofhsize{\percentofhsize}
  1388. \newif\ifsetpercent
  1389. \newcount\colcount
  1390. \def\setuptable#1{\def\firstarg{#1}%
  1391. \ifx\firstarg\xendsetuptable\let\go\relax%
  1392. \else
  1393.   \ifx\firstarg\xpercentofhsize\global\setpercenttrue%
  1394.   \else
  1395.     \ifsetpercent
  1396.        \if#1.\else%
  1397.        \global\advance\colcount by1 %
  1398.        \expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
  1399.        \fi
  1400.     \else
  1401.        \global\advance\colcount by1
  1402.        \setbox0=\hbox{#1}%
  1403.        \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
  1404.     \fi%
  1405.   \fi%
  1406.   \let\go\setuptable%
  1407. \fi\go}
  1408. % multitable syntax
  1409. \def\tab{&}
  1410. % @multitable ... @endmultitable definitions:
  1411. \def\multitable#1\item{\bgroup
  1412. \let\item\cr
  1413. \tolerance=9500
  1414. \hbadness=9500
  1415. \parskip=\intableparskip
  1416. \parindent=\intableparindent
  1417. \overfullrule=0pt
  1418. \global\colcount=0\relax%
  1419. \def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}%
  1420.  % To parse everything between @multitable and @item :
  1421. \def\one{#1}\expandafter\setuptable\one\endsetuptable
  1422.  % Need to reset this to 0 after \setuptable.
  1423. \global\colcount=0\relax% 
  1424.  % This preamble sets up a generic column definition, which will
  1425.  % be used as many times as user calls for columns.
  1426.  % \vtop will set a single line and will also let text wrap and 
  1427.  % continue for many paragraphs if desired.
  1428. \halign\bgroup&\global\advance\colcount by 1\relax%
  1429. \vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
  1430.  % In order to keep entries from bumping into each other
  1431.  % we will add a \leftskip of \spacebetweencols to all columns after
  1432.  % the first one.
  1433.  %  If a template has been used, we will add \spacebetweencols 
  1434.  % to the width of each template entry.
  1435.  %  If user has set preamble in terms of percent of \hsize
  1436.  % we will use that dimension as the width of the column, and
  1437.  % the \leftskip will keep entries from bumping into each other.
  1438.  % Table will start at left margin and final column will justify at
  1439.  % right margin.
  1440. \ifnum\colcount=1
  1441. \else
  1442.   \ifsetpercent
  1443.   \else
  1444.    % If user has <not> set preamble in terms of percent of \hsize
  1445.    % we will advance \hsize by \spacebetweencols 
  1446.   \advance\hsize by \spacebetweencols
  1447.   \fi
  1448.  % In either case we will make \leftskip=\spacebetweencols:
  1449. \leftskip=\spacebetweencols
  1450. \noindent##}\cr%
  1451.  % \everycr will reset column counter, \colcount, at the end of
  1452.  % each line. Every column  entry will cause \colcount to advance by one. 
  1453.  % The table preamble
  1454.  % looks at the current \colcount to find the correct column width.
  1455. \global\everycr{\noalign{\nointerlineskip\vskip\spacebetweenlines
  1456. \filbreak%% keeps underfull box messages off when table breaks over pages.
  1457. \global\colcount=0\relax}}}
  1458. \message{indexing,}
  1459. % Index generation facilities
  1460. % Define \newwrite to be identical to plain tex's \newwrite
  1461. % except not \outer, so it can be used within \newindex.
  1462. {\catcode`\@=11
  1463. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  1464. % \newindex {foo} defines an index named foo.
  1465. % It automatically defines \fooindex such that
  1466. % \fooindex ...rest of line... puts an entry in the index foo.
  1467. % It also defines \fooindfile to be the number of the output channel for
  1468. % the file that    accumulates this index.  The file's extension is foo.
  1469. % The name of an index should be no more than 2 characters long
  1470. % for the sake of vms.
  1471. \def\newindex #1{
  1472. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1473. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1474. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1475. \noexpand\doindex {#1}}
  1476. % @defindex foo  ==  \newindex{foo}
  1477. \def\defindex{\parsearg\newindex}
  1478. % Define @defcodeindex, like @defindex except put all entries in @code.
  1479. \def\newcodeindex #1{
  1480. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1481. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1482. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1483. \noexpand\docodeindex {#1}}
  1484. \def\defcodeindex{\parsearg\newcodeindex}
  1485. % @synindex foo bar    makes index foo feed into index bar.
  1486. % Do this instead of @defindex foo if you don't want it as a separate index.
  1487. \def\synindex #1 #2 {%
  1488. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1489. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1490. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1491. \noexpand\doindex {#2}}%
  1492. % @syncodeindex foo bar   similar, but put all entries made for index foo
  1493. % inside @code.
  1494. \def\syncodeindex #1 #2 {%
  1495. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1496. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1497. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1498. \noexpand\docodeindex {#2}}%
  1499. % Define \doindex, the driver for all \fooindex macros.
  1500. % Argument #1 is generated by the calling \fooindex macro,
  1501. %  and it is "foo", the name of the index.
  1502. % \doindex just uses \parsearg; it calls \doind for the actual work.
  1503. % This is because \doind is more useful to call from other macros.
  1504. % There is also \dosubind {index}{topic}{subtopic}
  1505. % which makes an entry in a two-level index such as the operation index.
  1506. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  1507. \def\singleindexer #1{\doind{\indexname}{#1}}
  1508. % like the previous two, but they put @code around the argument.
  1509. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  1510. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  1511. \def\indexdummies{%
  1512. % Take care of the plain tex accent commands.
  1513. \def\"{\realbackslash "}%
  1514. \def\`{\realbackslash `}%
  1515. \def\'{\realbackslash '}%
  1516. \def\^{\realbackslash ^}%
  1517. \def\~{\realbackslash ~}%
  1518. \def\={\realbackslash =}%
  1519. \def\b{\realbackslash b}%
  1520. \def\c{\realbackslash c}%
  1521. \def\d{\realbackslash d}%
  1522. \def\u{\realbackslash u}%
  1523. \def\v{\realbackslash v}%
  1524. \def\H{\realbackslash H}%
  1525. % Take care of the plain tex special European modified letters.
  1526. \def\oe{\realbackslash oe}%
  1527. \def\ae{\realbackslash ae}%
  1528. \def\aa{\realbackslash aa}%
  1529. \def\OE{\realbackslash OE}%
  1530. \def\AE{\realbackslash AE}%
  1531. \def\AA{\realbackslash AA}%
  1532. \def\o{\realbackslash o}%
  1533. \def\O{\realbackslash O}%
  1534. \def\l{\realbackslash l}%
  1535. \def\L{\realbackslash L}%
  1536. \def\ss{\realbackslash ss}%
  1537. % Take care of texinfo commands likely to appear in an index entry.
  1538. \def\_{{\realbackslash _}}%
  1539. \def\w{\realbackslash w }%
  1540. \def\bf{\realbackslash bf }%
  1541. \def\rm{\realbackslash rm }%
  1542. \def\sl{\realbackslash sl }%
  1543. \def\sf{\realbackslash sf}%
  1544. \def\tt{\realbackslash tt}%
  1545. \def\gtr{\realbackslash gtr}%
  1546. \def\less{\realbackslash less}%
  1547. \def\hat{\realbackslash hat}%
  1548. \def\char{\realbackslash char}%
  1549. \def\TeX{\realbackslash TeX}%
  1550. \def\dots{\realbackslash dots }%
  1551. \def\copyright{\realbackslash copyright }%
  1552. \def\tclose##1{\realbackslash tclose {##1}}%
  1553. \def\code##1{\realbackslash code {##1}}%
  1554. \def\samp##1{\realbackslash samp {##1}}%
  1555. \def\t##1{\realbackslash r {##1}}%
  1556. \def\r##1{\realbackslash r {##1}}%
  1557. \def\i##1{\realbackslash i {##1}}%
  1558. \def\b##1{\realbackslash b {##1}}%
  1559. \def\cite##1{\realbackslash cite {##1}}%
  1560. \def\key##1{\realbackslash key {##1}}%
  1561. \def\file##1{\realbackslash file {##1}}%
  1562. \def\var##1{\realbackslash var {##1}}%
  1563. \def\kbd##1{\realbackslash kbd {##1}}%
  1564. \def\dfn##1{\realbackslash dfn {##1}}%
  1565. \def\emph##1{\realbackslash emph {##1}}%
  1566. % \indexnofonts no-ops all font-change commands.
  1567. % This is used when outputting the strings to sort the index by.
  1568. \def\indexdummyfont#1{#1}
  1569. \def\indexdummytex{TeX}
  1570. \def\indexdummydots{...}
  1571. \def\indexnofonts{%
  1572. % Just ignore accents.
  1573. \let\"=\indexdummyfont
  1574. \let\`=\indexdummyfont
  1575. \let\'=\indexdummyfont
  1576. \let\^=\indexdummyfont
  1577. \let\~=\indexdummyfont
  1578. \let\==\indexdummyfont
  1579. \let\b=\indexdummyfont
  1580. \let\c=\indexdummyfont
  1581. \let\d=\indexdummyfont
  1582. \let\u=\indexdummyfont
  1583. \let\v=\indexdummyfont
  1584. \let\H=\indexdummyfont
  1585. % Take care of the plain tex special European modified letters.
  1586. \def\oe{oe}%
  1587. \def\ae{ae}%
  1588. \def\aa{aa}%
  1589. \def\OE{OE}%
  1590. \def\AE{AE}%
  1591. \def\AA{AA}%
  1592. \def\o{o}%
  1593. \def\O{O}%
  1594. \def\l{l}%
  1595. \def\L{L}%
  1596. \def\ss{ss}%
  1597. \let\w=\indexdummyfont
  1598. \let\t=\indexdummyfont
  1599. \let\r=\indexdummyfont
  1600. \let\i=\indexdummyfont
  1601. \let\b=\indexdummyfont
  1602. \let\emph=\indexdummyfont
  1603. \let\strong=\indexdummyfont
  1604. \let\cite=\indexdummyfont
  1605. \let\sc=\indexdummyfont
  1606. %Don't no-op \tt, since it isn't a user-level command
  1607. % and is used in the definitions of the active chars like <, >, |...
  1608. %\let\tt=\indexdummyfont
  1609. \let\tclose=\indexdummyfont
  1610. \let\code=\indexdummyfont
  1611. \let\file=\indexdummyfont
  1612. \let\samp=\indexdummyfont
  1613. \let\kbd=\indexdummyfont
  1614. \let\key=\indexdummyfont
  1615. \let\var=\indexdummyfont
  1616. \let\TeX=\indexdummytex
  1617. \let\dots=\indexdummydots
  1618. % To define \realbackslash, we must make \ not be an escape.
  1619. % We must first make another character (@) an escape
  1620. % so we do not become unable to do a definition.
  1621. {\catcode`\@=0 \catcode`\\=\other
  1622. @gdef@realbackslash{\}}
  1623. \let\indexbackslash=0  %overridden during \printindex.
  1624. \def\doind #1#2{%
  1625. {\count10=\lastpenalty %
  1626. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1627. \escapechar=`\\%
  1628. {\let\folio=0% Expand all macros now EXCEPT \folio
  1629. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  1630. % so it will be output as is; and it will print as backslash in the indx.
  1631. % Now process the index-string once, with all font commands turned off,
  1632. % to get the string to sort the index by.
  1633. {\indexnofonts
  1634. \xdef\temp1{#2}%
  1635. % Now produce the complete index entry.  We process the index-string again,
  1636. % this time with font commands expanded, to get what to print in the index.
  1637. \edef\temp{%
  1638. \write \csname#1indfile\endcsname{%
  1639. \realbackslash entry {\temp1}{\folio}{#2}}}%
  1640. \temp }%
  1641. }\penalty\count10}}
  1642. \def\dosubind #1#2#3{%
  1643. {\count10=\lastpenalty %
  1644. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1645. \escapechar=`\\%
  1646. {\let\folio=0%
  1647. \def\rawbackslashxx{\indexbackslash}%
  1648. % Now process the index-string once, with all font commands turned off,
  1649. % to get the string to sort the index by.
  1650. {\indexnofonts
  1651. \xdef\temp1{#2 #3}%
  1652. % Now produce the complete index entry.  We process the index-string again,
  1653. % this time with font commands expanded, to get what to print in the index.
  1654. \edef\temp{%
  1655. \write \csname#1indfile\endcsname{%
  1656. \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
  1657. \temp }%
  1658. }\penalty\count10}}
  1659. % The index entry written in the file actually looks like
  1660. %  \entry {sortstring}{page}{topic}
  1661. %  \entry {sortstring}{page}{topic}{subtopic}
  1662. % The texindex program reads in these files and writes files
  1663. % containing these kinds of lines:
  1664. %  \initial {c}
  1665. %     before the first topic whose initial is c
  1666. %  \entry {topic}{pagelist}
  1667. %     for a topic that is used without subtopics
  1668. %  \primary {topic}
  1669. %     for the beginning of a topic that is used with subtopics
  1670. %  \secondary {subtopic}{pagelist}
  1671. %     for each subtopic.
  1672. % Define the user-accessible indexing commands
  1673. % @findex, @vindex, @kindex, @cindex.
  1674. \def\findex {\fnindex}
  1675. \def\kindex {\kyindex}
  1676. \def\cindex {\cpindex}
  1677. \def\vindex {\vrindex}
  1678. \def\tindex {\tpindex}
  1679. \def\pindex {\pgindex}
  1680. \def\cindexsub {\begingroup\obeylines\cindexsub}
  1681. {\obeylines %
  1682. \gdef\cindexsub "#1" #2^^M{\endgroup %
  1683. \dosubind{cp}{#2}{#1}}}
  1684. % Define the macros used in formatting output of the sorted index material.
  1685. % This is what you call to cause a particular index to get printed.
  1686. % Write
  1687. % @unnumbered Function Index
  1688. % @printindex fn
  1689. \def\printindex{\parsearg\doprintindex}
  1690. \def\doprintindex#1{%
  1691.   \tex
  1692.   \dobreak \chapheadingskip {10000}
  1693.   \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
  1694.   \catcode`\$=\other
  1695.   \catcode`\~=\other
  1696.   \indexbreaks
  1697.   % The following don't help, since the chars were translated
  1698.   % when the raw index was written, and their fonts were discarded
  1699.   % due to \indexnofonts.
  1700.   %\catcode`\"=\active
  1701.   %\catcode`\^=\active
  1702.   %\catcode`\_=\active
  1703.   %\catcode`\|=\active
  1704.   %\catcode`\<=\active
  1705.   %\catcode`\>=\active
  1706.   % %
  1707.   \def\indexbackslash{\rawbackslashxx}
  1708.   \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
  1709.   \begindoublecolumns
  1710.   % See if the index file exists and is nonempty.
  1711.   \openin 1 \jobname.#1s
  1712.   \ifeof 1
  1713.     % \enddoublecolumns gets confused if there is no text in the index,
  1714.     % and it loses the chapter title and the aux file entries for the
  1715.     % index.  The easiest way to prevent this problem is to make sure
  1716.     % there is some text.
  1717.     (Index is nonexistent)
  1718.     \else
  1719.     %
  1720.     % If the index file exists but is empty, then \openin leaves \ifeof
  1721.     % false.  We have to make TeX try to read something from the file, so
  1722.     % it can discover if there is anything in it.
  1723.     \read 1 to \temp
  1724.     \ifeof 1
  1725.       (Index is empty)
  1726.     \else
  1727.       \input \jobname.#1s
  1728.     \fi
  1729.   \fi
  1730.   \closein 1
  1731.   \enddoublecolumns
  1732.   \Etex
  1733. % These macros are used by the sorted index file itself.
  1734. % Change them to control the appearance of the index.
  1735. % Same as \bigskipamount except no shrink.
  1736. % \balancecolumns gets confused if there is any shrink.
  1737. \newskip\initialskipamount \initialskipamount 12pt plus4pt
  1738. \def\initial #1{%
  1739. {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  1740. \ifdim\lastskip<\initialskipamount
  1741. \removelastskip \penalty-200 \vskip \initialskipamount\fi
  1742. \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
  1743. % This typesets a paragraph consisting of #1, dot leaders, and then #2
  1744. % flush to the right margin.  It is used for index and table of contents
  1745. % entries.  The paragraph is indented by \leftskip.
  1746. \def\entry #1#2{\begingroup
  1747.   % Start a new paragraph if necessary, so our assignments below can't
  1748.   % affect previous text.
  1749.   \par
  1750.   % Do not fill out the last line with white space.
  1751.   \parfillskip = 0in
  1752.   % No extra space above this paragraph.
  1753.   \parskip = 0in
  1754.   % Do not prefer a separate line ending with a hyphen to fewer lines.
  1755.   \finalhyphendemerits = 0
  1756.   % \hangindent is only relevant when the entry text and page number
  1757.   % don't both fit on one line.  In that case, bob suggests starting the
  1758.   % dots pretty far over on the line.  Unfortunately, a large
  1759.   % indentation looks wrong when the entry text itself is broken across
  1760.   % lines.  So we use a small indentation and put up with long leaders.
  1761.   % \hangafter is reset to 1 (which is the value we want) at the start
  1762.   % of each paragraph, so we need not do anything with that.
  1763.   \hangindent=2em
  1764.   % When the entry text needs to be broken, just fill out the first line
  1765.   % with blank space.
  1766.   \rightskip = 0pt plus1fil
  1767.   % Start a ``paragraph'' for the index entry so the line breaking
  1768.   % parameters we've set above will have an effect.
  1769.   \noindent
  1770.   % Insert the text of the index entry.  TeX will do line-breaking on it.
  1771.   #1%
  1772.   % The following is kluged to not output a line of dots in the index if
  1773.   % there are no page numbers.  The next person who breaks this will be
  1774.   % cursed by a Unix daemon.
  1775.   \def\tempa{{\rm }}%
  1776.   \def\tempb{#2}%
  1777.   \edef\tempc{\tempa}%
  1778.   \edef\tempd{\tempb}%
  1779.   \ifx\tempc\tempd\ \else%
  1780.     %
  1781.     % If we must, put the page number on a line of its own, and fill out
  1782.     % this line with blank space.  (The \hfil is overwhelmed with the
  1783.     % fill leaders glue in \indexdotfill if the page number does fit.)
  1784.     \hfil\penalty50
  1785.     \null\nobreak\indexdotfill % Have leaders before the page number.
  1786.     %
  1787.     % The `\ ' here is removed by the implicit \unskip that TeX does as
  1788.     % part of (the primitive) \par.  Without it, a spurious underfull
  1789.     % \hbox ensues.
  1790.     \ #2% The page number ends the paragraph.
  1791.   \fi%
  1792.   \par
  1793. \endgroup}
  1794. % Like \dotfill except takes at least 1 em.
  1795. \def\indexdotfill{\cleaders
  1796.   \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
  1797. \def\primary #1{\line{#1\hfil}}
  1798. \newskip\secondaryindent \secondaryindent=0.5cm
  1799. \def\secondary #1#2{
  1800. {\parfillskip=0in \parskip=0in
  1801. \hangindent =1in \hangafter=1
  1802. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
  1803. %% Define two-column mode, which is used in indexes.
  1804. %% Adapted from the TeXbook, page 416.
  1805. \catcode `\@=11
  1806. \newbox\partialpage
  1807. \newdimen\doublecolumnhsize
  1808. \def\begindoublecolumns{\begingroup
  1809.   % Grab any single-column material above us.
  1810.   \output = {\global\setbox\partialpage
  1811.     =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
  1812.   \eject
  1813.   % Now switch to the double-column output routine.
  1814.   \output={\doublecolumnout}%
  1815.   % Change the page size parameters.  We could do this once outside this
  1816.   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  1817.   % format, but then we repeat the same computation.  Repeating a couple
  1818.   % of assignments once per index is clearly meaningless for the
  1819.   % execution time, so we may as well do it once.
  1820.   % First we halve the line length, less a little for the gutter between
  1821.   % the columns.  We compute the gutter based on the line length, so it
  1822.   % changes automatically with the paper format.  The magic constant
  1823.   % below is chosen so that the gutter has the same value (well, +- <
  1824.   % 1pt) as it did when we hard-coded it.
  1825.   % We put the result in a separate register, \doublecolumhsize, so we
  1826.   % can restore it in \pagesofar, after \hsize itself has (potentially)
  1827.   % been clobbered.
  1828.   \doublecolumnhsize = \hsize
  1829.     \advance\doublecolumnhsize by -.04154\hsize
  1830.     \divide\doublecolumnhsize by 2
  1831.   \hsize = \doublecolumnhsize
  1832.   % Double the \vsize as well.  (We don't need a separate register here,
  1833.   % since nobody clobbers \vsize.)
  1834.   \vsize = 2\vsize
  1835.   \doublecolumnpagegoal
  1836. \def\enddoublecolumns{\eject \endgroup \pagegoal=\vsize \unvbox\partialpage}
  1837. \def\doublecolumnsplit{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  1838.   \global\dimen@=\pageheight \global\advance\dimen@ by-\ht\partialpage
  1839.   \global\setbox1=\vsplit255 to\dimen@ \global\setbox0=\vbox{\unvbox1}
  1840.   \global\setbox3=\vsplit255 to\dimen@ \global\setbox2=\vbox{\unvbox3}
  1841.   \ifdim\ht0>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
  1842.   \ifdim\ht2>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
  1843. \def\doublecolumnpagegoal{%
  1844.   \dimen@=\vsize \advance\dimen@ by-2\ht\partialpage \global\pagegoal=\dimen@
  1845. \def\pagesofar{\unvbox\partialpage %
  1846.   \hsize=\doublecolumnhsize % have to restore this since output routine
  1847.   \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
  1848. \def\doublecolumnout{%
  1849.   \setbox5=\copy255
  1850.   {\vbadness=10000 \doublecolumnsplit}
  1851.   \ifvbox255
  1852.     \setbox0=\vtop to\dimen@{\unvbox0}
  1853.     \setbox2=\vtop to\dimen@{\unvbox2}
  1854.     \onepageout\pagesofar \unvbox255 \penalty\outputpenalty
  1855.   \else
  1856.     \setbox0=\vbox{\unvbox5}
  1857.     \ifvbox0
  1858.       \dimen@=\ht0 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1859.       \divide\dimen@ by2 \splittopskip=\topskip \splitmaxdepth=\maxdepth
  1860.       {\vbadness=10000
  1861.     \loop \global\setbox5=\copy0
  1862.           \setbox1=\vsplit5 to\dimen@
  1863.           \setbox3=\vsplit5 to\dimen@
  1864.           \ifvbox5 \global\advance\dimen@ by1pt \repeat
  1865.         \setbox0=\vbox to\dimen@{\unvbox1}
  1866.         \setbox2=\vbox to\dimen@{\unvbox3}
  1867.         \global\setbox\partialpage=\vbox{\pagesofar}
  1868.         \doublecolumnpagegoal
  1869.       }
  1870.     \fi
  1871.   \fi
  1872. \catcode `\@=\other
  1873. \message{sectioning,}
  1874. % Define chapters, sections, etc.
  1875. \newcount \chapno
  1876. \newcount \secno        \secno=0
  1877. \newcount \subsecno     \subsecno=0
  1878. \newcount \subsubsecno  \subsubsecno=0
  1879. % This counter is funny since it counts through charcodes of letters A, B, ...
  1880. \newcount \appendixno  \appendixno = `\@
  1881. \def\appendixletter{\char\the\appendixno}
  1882. \newwrite \contentsfile
  1883. % This is called from \setfilename.
  1884. \def\opencontents{\openout \contentsfile = \jobname.toc}
  1885. % Each @chapter defines this as the name of the chapter.
  1886. % page headings and footings can use it.  @section does likewise
  1887. \def\thischapter{} \def\thissection{}
  1888. \def\seccheck#1{\if \pageno<0 %
  1889. \errmessage{@#1 not allowed after generating table of contents}\fi
  1890. \def\chapternofonts{%
  1891. \let\rawbackslash=\relax%
  1892. \let\frenchspacing=\relax%
  1893. \def\result{\realbackslash result}
  1894. \def\equiv{\realbackslash equiv}
  1895. \def\expansion{\realbackslash expansion}
  1896. \def\print{\realbackslash print}
  1897. \def\TeX{\realbackslash TeX}
  1898. \def\dots{\realbackslash dots}
  1899. \def\copyright{\realbackslash copyright}
  1900. \def\tt{\realbackslash tt}
  1901. \def\bf{\realbackslash bf }
  1902. \def\w{\realbackslash w}
  1903. \def\less{\realbackslash less}
  1904. \def\gtr{\realbackslash gtr}
  1905. \def\hat{\realbackslash hat}
  1906. \def\char{\realbackslash char}
  1907. \def\tclose##1{\realbackslash tclose {##1}}
  1908. \def\code##1{\realbackslash code {##1}}
  1909. \def\samp##1{\realbackslash samp {##1}}
  1910. \def\r##1{\realbackslash r {##1}}
  1911. \def\b##1{\realbackslash b {##1}}
  1912. \def\key##1{\realbackslash key {##1}}
  1913. \def\file##1{\realbackslash file {##1}}
  1914. \def\kbd##1{\realbackslash kbd {##1}}
  1915. % These are redefined because @smartitalic wouldn't work inside xdef.
  1916. \def\i##1{\realbackslash i {##1}}
  1917. \def\cite##1{\realbackslash cite {##1}}
  1918. \def\var##1{\realbackslash var {##1}}
  1919. \def\emph##1{\realbackslash emph {##1}}
  1920. \def\dfn##1{\realbackslash dfn {##1}}
  1921. \newcount\absseclevel % used to calculate proper heading level
  1922. \newcount\secbase\secbase=0 % @raise/lowersections modify this count
  1923. % @raisesections: treat @section as chapter, @subsection as section, etc.
  1924. \def\raisesections{\global\advance\secbase by -1}
  1925. \let\up=\raisesections % original BFox name
  1926. % @lowersections: treat @chapter as section, @section as subsection, etc.
  1927. \def\lowersections{\global\advance\secbase by 1}
  1928. \let\down=\lowersections % original BFox name
  1929. % Choose a numbered-heading macro
  1930. % #1 is heading level if unmodified by @raisesections or @lowersections
  1931. % #2 is text for heading
  1932. \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1933. \ifcase\absseclevel
  1934.   \chapterzzz{#2}
  1935.   \seczzz{#2}
  1936.   \numberedsubseczzz{#2}
  1937.   \numberedsubsubseczzz{#2}
  1938. \else
  1939.   \ifnum \absseclevel<0
  1940.     \chapterzzz{#2}
  1941.   \else
  1942.     \numberedsubsubseczzz{#2}
  1943.   \fi
  1944. % like \numhead, but chooses appendix heading levels
  1945. \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1946. \ifcase\absseclevel
  1947.   \appendixzzz{#2}
  1948.   \appendixsectionzzz{#2}
  1949.   \appendixsubseczzz{#2}
  1950.   \appendixsubsubseczzz{#2}
  1951. \else
  1952.   \ifnum \absseclevel<0
  1953.     \appendixzzz{#2}
  1954.   \else
  1955.     \appendixsubsubseczzz{#2}
  1956.   \fi
  1957. % like \numhead, but chooses numberless heading levels
  1958. \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1959. \ifcase\absseclevel
  1960.   \unnumberedzzz{#2}
  1961.   \unnumberedseczzz{#2}
  1962.   \unnumberedsubseczzz{#2}
  1963.   \unnumberedsubsubseczzz{#2}
  1964. \else
  1965.   \ifnum \absseclevel<0
  1966.     \unnumberedzzz{#2}
  1967.   \else
  1968.     \unnumberedsubsubseczzz{#2}
  1969.   \fi
  1970. \def\thischaptername{No Chapter Title}
  1971. \outer\def\chapter{\parsearg\chapteryyy}
  1972. \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
  1973. \def\chapterzzz #1{\seccheck{chapter}%
  1974. \secno=0 \subsecno=0 \subsubsecno=0
  1975. \global\advance \chapno by 1 \message{Chapter \the\chapno}%
  1976. \chapmacro {#1}{\the\chapno}%
  1977. \gdef\thissection{#1}%
  1978. \gdef\thischaptername{#1}%
  1979. % We don't substitute the actual chapter name into \thischapter
  1980. % because we don't want its macros evaluated now.
  1981. \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
  1982. {\chapternofonts%
  1983. \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
  1984. \escapechar=`\\%
  1985. \write \contentsfile \temp  %
  1986. \donoderef %
  1987. \global\let\section = \numberedsec
  1988. \global\let\subsection = \numberedsubsec
  1989. \global\let\subsubsection = \numberedsubsubsec
  1990. \outer\def\appendix{\parsearg\appendixyyy}
  1991. \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
  1992. \def\appendixzzz #1{\seccheck{appendix}%
  1993. \secno=0 \subsecno=0 \subsubsecno=0
  1994. \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
  1995. \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
  1996. \gdef\thissection{#1}%
  1997. \gdef\thischaptername{#1}%
  1998. \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
  1999. {\chapternofonts%
  2000. \edef\temp{{\realbackslash chapentry
  2001.   {#1}{\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
  2002. \escapechar=`\\%
  2003. \write \contentsfile \temp  %
  2004. \appendixnoderef %
  2005. \global\let\section = \appendixsec
  2006. \global\let\subsection = \appendixsubsec
  2007. \global\let\subsubsection = \appendixsubsubsec
  2008. \outer\def\top{\parsearg\unnumberedyyy}
  2009. \outer\def\unnumbered{\parsearg\unnumberedyyy}
  2010. \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
  2011. \def\unnumberedzzz #1{\seccheck{unnumbered}%
  2012. \secno=0 \subsecno=0 \subsubsecno=0
  2013. % This used to be simply \message{#1}, but TeX fully expands the
  2014. % argument to \message.  Therefore, if #1 contained @-commands, TeX
  2015. % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
  2016. % expanded @cite (which turns out to cause errors because \cite is meant
  2017. % to be executed, not expanded).
  2018. % Anyway, we don't want the fully-expanded definition of @cite to appear
  2019. % as a result of the \message, we just want `@cite' itself.  We use
  2020. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  2021. % simply yielding the contents of the <toks register>.
  2022. \toks0 = {#1}\message{(\the\toks0)}%
  2023. \unnumbchapmacro {#1}%
  2024. \gdef\thischapter{#1}\gdef\thissection{#1}%
  2025. {\chapternofonts%
  2026. \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
  2027. \escapechar=`\\%
  2028. \write \contentsfile \temp  %
  2029. \unnumbnoderef %
  2030. \global\let\section = \unnumberedsec
  2031. \global\let\subsection = \unnumberedsubsec
  2032. \global\let\subsubsection = \unnumberedsubsubsec
  2033. \outer\def\numberedsec{\parsearg\secyyy}
  2034. \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
  2035. \def\seczzz #1{\seccheck{section}%
  2036. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  2037. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  2038. {\chapternofonts%
  2039. \edef\temp{{\realbackslash secentry %
  2040. {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
  2041. \escapechar=`\\%
  2042. \write \contentsfile \temp %
  2043. \donoderef %
  2044. \penalty 10000 %
  2045. \outer\def\appenixsection{\parsearg\appendixsecyyy}
  2046. \outer\def\appendixsec{\parsearg\appendixsecyyy}
  2047. \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
  2048. \def\appendixsectionzzz #1{\seccheck{appendixsection}%
  2049. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  2050. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  2051. {\chapternofonts%
  2052. \edef\temp{{\realbackslash secentry %
  2053. {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
  2054. \escapechar=`\\%
  2055. \write \contentsfile \temp %
  2056. \appendixnoderef %
  2057. \penalty 10000 %
  2058. \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
  2059. \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
  2060. \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
  2061. \plainsecheading {#1}\gdef\thissection{#1}%
  2062. {\chapternofonts%
  2063. \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
  2064. \escapechar=`\\%
  2065. \write \contentsfile \temp %
  2066. \unnumbnoderef %
  2067. \penalty 10000 %
  2068. \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
  2069. \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
  2070. \def\numberedsubseczzz #1{\seccheck{subsection}%
  2071. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  2072. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  2073. {\chapternofonts%
  2074. \edef\temp{{\realbackslash subsecentry %
  2075. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  2076. \escapechar=`\\%
  2077. \write \contentsfile \temp %
  2078. \donoderef %
  2079. \penalty 10000 %
  2080. \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
  2081. \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
  2082. \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
  2083. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  2084. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  2085. {\chapternofonts%
  2086. \edef\temp{{\realbackslash subsecentry %
  2087. {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  2088. \escapechar=`\\%
  2089. \write \contentsfile \temp %
  2090. \appendixnoderef %
  2091. \penalty 10000 %
  2092. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
  2093. \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
  2094. \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
  2095. \plainsecheading {#1}\gdef\thissection{#1}%
  2096. {\chapternofonts%
  2097. \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
  2098. \escapechar=`\\%
  2099. \write \contentsfile \temp %
  2100. \unnumbnoderef %
  2101. \penalty 10000 %
  2102. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
  2103. \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
  2104. \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
  2105. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  2106. \subsubsecheading {#1}
  2107.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  2108. {\chapternofonts%
  2109. \edef\temp{{\realbackslash subsubsecentry %
  2110.   {#1}
  2111.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
  2112.   {\noexpand\folio}}}%
  2113. \escapechar=`\\%
  2114. \write \contentsfile \temp %
  2115. \donoderef %
  2116. \penalty 10000 %
  2117. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
  2118. \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
  2119. \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
  2120. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  2121. \subsubsecheading {#1}
  2122.   {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  2123. {\chapternofonts%
  2124. \edef\temp{{\realbackslash subsubsecentry{#1}%
  2125.   {\appendixletter}
  2126.   {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
  2127. \escapechar=`\\%
  2128. \write \contentsfile \temp %
  2129. \appendixnoderef %
  2130. \penalty 10000 %
  2131. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
  2132. \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
  2133. \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
  2134. \plainsecheading {#1}\gdef\thissection{#1}%
  2135. {\chapternofonts%
  2136. \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
  2137. \escapechar=`\\%
  2138. \write \contentsfile \temp %
  2139. \unnumbnoderef %
  2140. \penalty 10000 %
  2141. % These are variants which are not "outer", so they can appear in @ifinfo.
  2142. % Actually, they should now be obsolete; ordinary section commands should work.
  2143. \def\infotop{\parsearg\unnumberedzzz}
  2144. \def\infounnumbered{\parsearg\unnumberedzzz}
  2145. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  2146. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  2147. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  2148. \def\infoappendix{\parsearg\appendixzzz}
  2149. \def\infoappendixsec{\parsearg\appendixseczzz}
  2150. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  2151. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  2152. \def\infochapter{\parsearg\chapterzzz}
  2153. \def\infosection{\parsearg\sectionzzz}
  2154. \def\infosubsection{\parsearg\subsectionzzz}
  2155. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  2156. % These macros control what the section commands do, according
  2157. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  2158. % Define them by default for a numbered chapter.
  2159. \global\let\section = \numberedsec
  2160. \global\let\subsection = \numberedsubsec
  2161. \global\let\subsubsection = \numberedsubsubsec
  2162. % Define @majorheading, @heading and @subheading
  2163. % NOTE on use of \vbox for chapter headings, section headings, and
  2164. % such:
  2165. %    1) We use \vbox rather than the earlier \line to permit
  2166. %       overlong headings to fold.
  2167. %    2) \hyphenpenalty is set to 10000 because hyphenation in a
  2168. %       heading is obnoxious; this forbids it.
  2169. %       3) Likewise, headings look best if no \parindent is used, and
  2170. %          if justification is not attempted.  Hence \raggedright.
  2171. \def\majorheading{\parsearg\majorheadingzzz}
  2172. \def\majorheadingzzz #1{%
  2173. {\advance\chapheadingskip by 10pt \chapbreak }%
  2174. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2175.                   \parindent=0pt\raggedright
  2176.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  2177. \def\chapheading{\parsearg\chapheadingzzz}
  2178. \def\chapheadingzzz #1{\chapbreak %
  2179. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2180.                   \parindent=0pt\raggedright
  2181.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  2182. \def\heading{\parsearg\secheadingi}
  2183. \def\subheading{\parsearg\subsecheadingi}
  2184. \def\subsubheading{\parsearg\subsubsecheadingi}
  2185. % These macros generate a chapter, section, etc. heading only
  2186. % (including whitespace, linebreaking, etc. around it),
  2187. % given all the information in convenient, parsed form.
  2188. %%% Args are the skip and penalty (usually negative)
  2189. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  2190. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  2191. %%% Define plain chapter starts, and page on/off switching for it
  2192. % Parameter controlling skip before chapter headings (if needed)
  2193. \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
  2194. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  2195. \def\chappager{\par\vfill\supereject}
  2196. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  2197. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  2198. \def\CHAPPAGoff{
  2199. \global\let\pchapsepmacro=\chapbreak
  2200. \global\let\pagealignmacro=\chappager}
  2201. \def\CHAPPAGon{
  2202. \global\let\pchapsepmacro=\chappager
  2203. \global\let\pagealignmacro=\chappager
  2204. \global\def\HEADINGSon{\HEADINGSsingle}}
  2205. \def\CHAPPAGodd{
  2206. \global\let\pchapsepmacro=\chapoddpage
  2207. \global\let\pagealignmacro=\chapoddpage
  2208. \global\def\HEADINGSon{\HEADINGSdouble}}
  2209. \CHAPPAGon
  2210. \def\CHAPFplain{
  2211. \global\let\chapmacro=\chfplain
  2212. \global\let\unnumbchapmacro=\unnchfplain}
  2213. \def\chfplain #1#2{%
  2214.   \pchapsepmacro
  2215.     \chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2216.                      \parindent=0pt\raggedright
  2217.                      \rm #2\enspace #1}%
  2218.   \bigskip
  2219.   \penalty5000
  2220. \def\unnchfplain #1{%
  2221. \pchapsepmacro %
  2222. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2223.                   \parindent=0pt\raggedright
  2224.                   \rm #1\hfill}}\bigskip \par\penalty 10000 %
  2225. \CHAPFplain % The default
  2226. \def\unnchfopen #1{%
  2227. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2228.                        \parindent=0pt\raggedright
  2229.                        \rm #1\hfill}}\bigskip \par\penalty 10000 %
  2230. \def\chfopen #1#2{\chapoddpage {\chapfonts
  2231. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  2232. \par\penalty 5000 %
  2233. \def\CHAPFopen{
  2234. \global\let\chapmacro=\chfopen
  2235. \global\let\unnumbchapmacro=\unnchfopen}
  2236. % Parameter controlling skip before section headings.
  2237. \newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
  2238. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  2239. \newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
  2240. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  2241. % @paragraphindent  is defined for the Info formatting commands only.
  2242. \let\paragraphindent=\comment
  2243. % Section fonts are the base font at magstep2, which produces
  2244. % a size a bit more than 14 points in the default situation.
  2245. \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
  2246. \def\plainsecheading #1{\secheadingi {#1}}
  2247. \def\secheadingi #1{{\advance \secheadingskip by \parskip %
  2248. \secheadingbreak}%
  2249. {\secfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2250.                  \parindent=0pt\raggedright
  2251.                  \rm #1\hfill}}%
  2252. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  2253. % Subsection fonts are the base font at magstep1,
  2254. % which produces a size of 12 points.
  2255. \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
  2256. \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  2257. \subsecheadingbreak}%
  2258. {\subsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2259.                      \parindent=0pt\raggedright
  2260.                      \rm #1\hfill}}%
  2261. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  2262. \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
  2263.                   % Perhaps make sssec fonts scaled
  2264.                   % magstep half
  2265. \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
  2266. \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  2267. \subsecheadingbreak}%
  2268. {\subsubsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2269.                        \parindent=0pt\raggedright
  2270.                        \rm #1\hfill}}%
  2271. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
  2272. \message{toc printing,}
  2273. % Finish up the main text and prepare to read what we've written
  2274. % to \contentsfile.
  2275. \newskip\contentsrightmargin \contentsrightmargin=1in
  2276. \def\startcontents#1{%
  2277.    \pagealignmacro
  2278.    \immediate\closeout \contentsfile
  2279.    \ifnum \pageno>0
  2280.       \pageno = -1        % Request roman numbered pages.
  2281.    \fi
  2282.    % Don't need to put `Contents' or `Short Contents' in the headline.
  2283.    % It is abundantly clear what they are.
  2284.    \unnumbchapmacro{#1}\def\thischapter{}%
  2285.    \begingroup           % Set up to handle contents files properly.
  2286.       \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  2287.       \raggedbottom             % Worry more about breakpoints than the bottom.
  2288.       \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  2289. % Normal (long) toc.
  2290. \outer\def\contents{%
  2291.    \startcontents{\putwordTableofContents}%
  2292.       \input \jobname.toc
  2293.    \endgroup
  2294.    \vfill \eject
  2295. % And just the chapters.
  2296. \outer\def\summarycontents{%
  2297.    \startcontents{\putwordShortContents}%
  2298.       %
  2299.       \let\chapentry = \shortchapentry
  2300.       \let\unnumbchapentry = \shortunnumberedentry
  2301.       % We want a true roman here for the page numbers.
  2302.       \secfonts
  2303.       \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
  2304.       \rm
  2305.       \advance\baselineskip by 1pt % Open it up a little.
  2306.       \def\secentry ##1##2##3##4{}
  2307.       \def\unnumbsecentry ##1##2{}
  2308.       \def\subsecentry ##1##2##3##4##5{}
  2309.       \def\unnumbsubsecentry ##1##2{}
  2310.       \def\subsubsecentry ##1##2##3##4##5##6{}
  2311.       \def\unnumbsubsubsecentry ##1##2{}
  2312.       \input \jobname.toc
  2313.    \endgroup
  2314.    \vfill \eject
  2315. \let\shortcontents = \summarycontents
  2316. % These macros generate individual entries in the table of contents.
  2317. % The first argument is the chapter or section name.
  2318. % The last argument is the page number.
  2319. % The arguments in between are the chapter number, section number, ...
  2320. % Chapter-level things, for both the long and short contents.
  2321. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  2322. % See comments in \dochapentry re vbox and related settings
  2323. \def\shortchapentry#1#2#3{%
  2324.   \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
  2325. % Typeset the label for a chapter or appendix for the short contents.
  2326. % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
  2327. % We could simplify the code here by writing out an \appendixentry
  2328. % command in the toc file for appendices, instead of using \chapentry
  2329. % for both, but it doesn't seem worth it.
  2330. \setbox0 = \hbox{\shortcontrm \putwordAppendix }
  2331. \newdimen\shortappendixwidth \shortappendixwidth = \wd0
  2332. \def\shortchaplabel#1{%
  2333.   % We typeset #1 in a box of constant width, regardless of the text of
  2334.   % #1, so the chapter titles will come out aligned.
  2335.   \setbox0 = \hbox{#1}%
  2336.   \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
  2337.   % This space should be plenty, since a single number is .5em, and the
  2338.   % widest letter (M) is 1em, at least in the Computer Modern fonts.
  2339.   % (This space doesn't include the extra space that gets added after
  2340.   % the label; that gets put in in \shortchapentry above.)
  2341.   \advance\dimen0 by 1.1em
  2342.   \hbox to \dimen0{#1\hfil}%
  2343. \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  2344. \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
  2345. % Sections.
  2346. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  2347. \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  2348. % Subsections.
  2349. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  2350. \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  2351. % And subsubsections.
  2352. \def\subsubsecentry#1#2#3#4#5#6{%
  2353.   \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  2354. \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  2355. % This parameter controls the indentation of the various levels.
  2356. \newdimen\tocindent \tocindent = 3pc
  2357. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  2358. % page number.
  2359. % If the toc has to be broken over pages, we would want to be at chapters
  2360. % if at all possible; hence the \penalty.
  2361. \def\dochapentry#1#2{%
  2362.    \penalty-300 \vskip\baselineskip
  2363.    \begingroup
  2364.      \chapentryfonts
  2365.      \tocentry{#1}{\dopageno{#2}}%
  2366.    \endgroup
  2367.    \nobreak\vskip .25\baselineskip
  2368. \def\dosecentry#1#2{\begingroup
  2369.   \secentryfonts \leftskip=\tocindent
  2370.   \tocentry{#1}{\dopageno{#2}}%
  2371. \endgroup}
  2372. \def\dosubsecentry#1#2{\begingroup
  2373.   \subsecentryfonts \leftskip=2\tocindent
  2374.   \tocentry{#1}{\dopageno{#2}}%
  2375. \endgroup}
  2376. \def\dosubsubsecentry#1#2{\begingroup
  2377.   \subsubsecentryfonts \leftskip=3\tocindent
  2378.   \tocentry{#1}{\dopageno{#2}}%
  2379. \endgroup}
  2380. % Final typesetting of a toc entry; we use the same \entry macro as for
  2381. % the index entries, but we want to suppress hyphenation here.  (We
  2382. % can't do that in the \entry macro, since index entries might consist
  2383. % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
  2384. \def\tocentry#1#2{\begingroup
  2385.   \hyphenpenalty = 10000
  2386.   \entry{#1}{#2}%
  2387. \endgroup}
  2388. % Space between chapter (or whatever) number and the title.
  2389. \def\labelspace{\hskip1em \relax}
  2390. \def\dopageno#1{{\rm #1}}
  2391. \def\doshortpageno#1{{\rm #1}}
  2392. \def\chapentryfonts{\secfonts \rm}
  2393. \def\secentryfonts{\textfonts}
  2394. \let\subsecentryfonts = \textfonts
  2395. \let\subsubsecentryfonts = \textfonts
  2396. \message{environments,}
  2397. % Since these characters are used in examples, it should be an even number of
  2398. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  2399. % Furthermore, these definitions must come after we define our fonts.
  2400. \newbox\dblarrowbox    \newbox\longdblarrowbox
  2401. \newbox\pushcharbox    \newbox\bullbox
  2402. \newbox\equivbox       \newbox\errorbox
  2403. \let\ptexequiv = \equiv
  2404. %{\tentt
  2405. %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
  2406. %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
  2407. %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
  2408. %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
  2409. % Adapted from the manmac format (p.420 of TeXbook)
  2410. %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
  2411. %                                      depth .1ex\hfil}
  2412. \def\point{$\star$}
  2413. \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  2414. \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
  2415. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  2416. \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  2417. % Adapted from the TeXbook's \boxit.
  2418. {\tentt \global\dimen0 = 3em}% Width of the box.
  2419. \dimen2 = .55pt % Thickness of rules
  2420. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  2421. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  2422. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  2423.    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  2424.    \advance\hsize by -2\dimen2 % Rules.
  2425.    \vbox{
  2426.       \hrule height\dimen2
  2427.       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  2428.          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  2429.          \kern3pt\vrule width\dimen2}% Space to right.
  2430.       \hrule height\dimen2}
  2431.     \hfil}
  2432. % The @error{} command.
  2433. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  2434. % @tex ... @end tex    escapes into raw Tex temporarily.
  2435. % One exception: @ is still an escape character, so that @end tex works.
  2436. % But \@ or @@ will get a plain tex @ character.
  2437. \def\tex{\begingroup
  2438. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  2439. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  2440. \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
  2441. \catcode `\%=14
  2442. \catcode 43=12
  2443. \catcode`\"=12
  2444. \catcode`\==12
  2445. \catcode`\|=12
  2446. \catcode`\<=12
  2447. \catcode`\>=12
  2448. \escapechar=`\\
  2449. \let\~=\ptextilde
  2450. \let\{=\ptexlbrace
  2451. \let\}=\ptexrbrace
  2452. \let\.=\ptexdot
  2453. \let\*=\ptexstar
  2454. \let\dots=\ptexdots
  2455. \def\@{@}%
  2456. \let\bullet=\ptexbullet
  2457. \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
  2458. \let\L=\ptexL
  2459. \let\Etex=\endgroup}
  2460. % Define @lisp ... @endlisp.
  2461. % @lisp does a \begingroup so it can rebind things,
  2462. % including the definition of @endlisp (which normally is erroneous).
  2463. % Amount to narrow the margins by for @lisp.
  2464. \newskip\lispnarrowing \lispnarrowing=0.4in
  2465. % This is the definition that ^^M gets inside @lisp, @example, and other
  2466. % such environments.  \null is better than a space, since it doesn't
  2467. % have any width.
  2468. \def\lisppar{\null\endgraf}
  2469. % Make each space character in the input produce a normal interword
  2470. % space in the output.  Don't allow a line break at this space, as this
  2471. % is used only in environments like @example, where each line of input
  2472. % should produce a line of output anyway.
  2473. {\obeyspaces %
  2474. \gdef\sepspaces{\obeyspaces\let =\tie}}
  2475. % Define \obeyedspace to be our active space, whatever it is.  This is
  2476. % for use in \parsearg.
  2477. {\sepspaces%
  2478. \global\let\obeyedspace= }
  2479. % This space is always present above and below environments.
  2480. \newskip\envskipamount \envskipamount = 0pt
  2481. % Make spacing and below environment symmetrical.  We use \parskip here
  2482. % to help in doing that, since in @example-like environments \parskip
  2483. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  2484. % start of the next paragraph will insert \parskip
  2485. \def\aboveenvbreak{{\advance\envskipamount by \parskip
  2486. \endgraf \ifdim\lastskip<\envskipamount
  2487. \removelastskip \penalty-50 \vskip\envskipamount \fi}}
  2488. \let\afterenvbreak = \aboveenvbreak
  2489. % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
  2490. \let\nonarrowing=\relax
  2491. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2492. % \cartouche: draw rectangle w/rounded corners around argument
  2493. \font\circle=lcircle10
  2494. \newdimen\circthick
  2495. \newdimen\cartouter\newdimen\cartinner
  2496. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  2497. \circthick=\fontdimen8\circle
  2498. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  2499. \def\ctr{{\hskip 6pt\circle\char'010}}
  2500. \def\cbl{{\circle\char'012\hskip -6pt}}
  2501. \def\cbr{{\hskip 6pt\circle\char'011}}
  2502. \def\carttop{\hbox to \cartouter{\hskip\lskip
  2503.     \ctl\leaders\hrule height\circthick\hfil\ctr
  2504.     \hskip\rskip}}
  2505. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  2506.     \cbl\leaders\hrule height\circthick\hfil\cbr
  2507.     \hskip\rskip}}
  2508. \newskip\lskip\newskip\rskip
  2509. \long\def\cartouche{%
  2510. \begingroup
  2511.     \lskip=\leftskip \rskip=\rightskip
  2512.     \leftskip=0pt\rightskip=0pt %we want these *outside*.
  2513.     \cartinner=\hsize \advance\cartinner by-\lskip
  2514.                \advance\cartinner by-\rskip
  2515.     \cartouter=\hsize
  2516.     \advance\cartouter by 18pt % allow for 3pt kerns on either
  2517. %                     side, and for 6pt waste from
  2518. %                     each corner char
  2519.     \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  2520.     % Flag to tell @lisp, etc., not to narrow margin.
  2521.     \let\nonarrowing=\comment
  2522.     \vbox\bgroup
  2523.         \baselineskip=0pt\parskip=0pt\lineskip=0pt
  2524.         \carttop
  2525.         \hbox\bgroup
  2526.             \hskip\lskip
  2527.             \vrule\kern3pt
  2528.             \vbox\bgroup
  2529.                 \hsize=\cartinner
  2530.                 \kern3pt
  2531.                 \begingroup
  2532.                     \baselineskip=\normbskip
  2533.                     \lineskip=\normlskip
  2534.                     \parskip=\normpskip
  2535.                     \vskip -\parskip
  2536. \def\Ecartouche{%
  2537.                 \endgroup
  2538.                 \kern3pt
  2539.             \egroup
  2540.             \kern3pt\vrule
  2541.             \hskip\rskip
  2542.         \egroup
  2543.         \cartbot
  2544.     \egroup
  2545. \endgroup
  2546. % This macro is called at the beginning of all the @example variants,
  2547. % inside a group.
  2548. \def\nonfillstart{%
  2549.   \aboveenvbreak
  2550.   \inENV % This group ends at the end of the body
  2551.   \hfuzz = 12pt % Don't be fussy
  2552.   \sepspaces % Make spaces be word-separators rather than space tokens.
  2553.   \singlespace
  2554.   \let\par = \lisppar % don't ignore blank lines
  2555.   \obeylines % each line of input is a line of output
  2556.   \parskip = 0pt
  2557.   \parindent = 0pt
  2558.   \emergencystretch = 0pt % don't try to avoid overfull boxes
  2559.   % @cartouche defines \nonarrowing to inhibit narrowing
  2560.   % at next level down.
  2561.   \ifx\nonarrowing\relax
  2562.     \advance \leftskip by \lispnarrowing
  2563.     \exdentamount=\lispnarrowing
  2564.     \let\exdent=\nofillexdent
  2565.     \let\nonarrowing=\relax
  2566.   \fi
  2567. % To ending an @example-like environment, we first end the paragraph
  2568. % (via \afterenvbreak's vertical glue), and then the group.  That way we
  2569. % keep the zero \parskip that the environments set -- \parskip glue
  2570. % will be inserted at the beginning of the next paragraph in the
  2571. % document, after the environment.
  2572. \def\nonfillfinish{\afterenvbreak\endgroup}%
  2573. % This macro is
  2574. \def\lisp{\begingroup
  2575.   \nonfillstart
  2576.   \let\Elisp = \nonfillfinish
  2577.   \tt
  2578.   \rawbackslash % have \ input char produce \ char from current font
  2579.   \gobble
  2580. % Define the \E... control sequence only if we are inside the
  2581. % environment, so the error checking in \end will work.
  2582. % We must call \lisp last in the definition, since it reads the
  2583. % return following the @example (or whatever) command.
  2584. \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
  2585. \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
  2586. \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
  2587. % @smallexample and @smalllisp.  This is not used unless the @smallbook
  2588. % command is given.  Originally contributed by Pavel@xerox.
  2589. \def\smalllispx{\begingroup
  2590.   \nonfillstart
  2591.   \let\Esmalllisp = \nonfillfinish
  2592.   \let\Esmallexample = \nonfillfinish
  2593.   % Smaller interline space and fonts for small examples.
  2594.   \setleading{10pt}%
  2595.   \indexfonts \tt
  2596.   \rawbackslash % make \ output the \ character from the current font (tt)
  2597.   \gobble
  2598. % This is @display; same as @lisp except use roman font.
  2599. \def\display{\begingroup
  2600.   \nonfillstart
  2601.   \let\Edisplay = \nonfillfinish
  2602.   \gobble
  2603. % This is @format; same as @display except don't narrow margins.
  2604. \def\format{\begingroup
  2605.   \let\nonarrowing = t
  2606.   \nonfillstart
  2607.   \let\Eformat = \nonfillfinish
  2608.   \gobble
  2609. % @flushleft (same as @format) and @flushright.
  2610. \def\flushleft{\begingroup
  2611.   \let\nonarrowing = t
  2612.   \nonfillstart
  2613.   \let\Eflushleft = \nonfillfinish
  2614.   \gobble
  2615. \def\flushright{\begingroup
  2616.   \let\nonarrowing = t
  2617.   \nonfillstart
  2618.   \let\Eflushright = \nonfillfinish
  2619.   \advance\leftskip by 0pt plus 1fill
  2620.   \gobble}
  2621. % @quotation does normal linebreaking (hence we can't use \nonfillstart)
  2622. % and narrows the margins.
  2623. \def\quotation{%
  2624.   \begingroup\inENV %This group ends at the end of the @quotation body
  2625.   {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
  2626.   \singlespace
  2627.   \parindent=0pt
  2628.   % We have retained a nonzero parskip for the environment, since we're
  2629.   % doing normal filling. So to avoid extra space below the environment...
  2630.   \def\Equotation{\parskip = 0pt \nonfillfinish}%
  2631.   % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  2632.   \ifx\nonarrowing\relax
  2633.     \advance\leftskip by \lispnarrowing
  2634.     \advance\rightskip by \lispnarrowing
  2635.     \exdentamount = \lispnarrowing
  2636.     \let\nonarrowing = \relax
  2637.   \fi
  2638. \message{defuns,}
  2639. % Define formatter for defuns
  2640. % First, allow user to change definition object font (\df) internally
  2641. \def\setdeffont #1 {\csname DEF#1\endcsname}
  2642. \newskip\defbodyindent \defbodyindent=.4in
  2643. \newskip\defargsindent \defargsindent=50pt
  2644. \newskip\deftypemargin \deftypemargin=12pt
  2645. \newskip\deflastargmargin \deflastargmargin=18pt
  2646. \newcount\parencount
  2647. % define \functionparens, which makes ( and ) and & do special things.
  2648. % \functionparens affects the group it is contained in.
  2649. \def\activeparens{%
  2650. \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
  2651. \catcode`\[=\active \catcode`\]=\active}
  2652. % Make control sequences which act like normal parenthesis chars.
  2653. \let\lparen = ( \let\rparen = )
  2654. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  2655. % Be sure that we always have a definition for `(', etc.  For example,
  2656. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  2657. % so TeX would otherwise complain about undefined control sequence.
  2658. \global\let(=\lparen \global\let)=\rparen
  2659. \global\let[=\lbrack \global\let]=\rbrack
  2660. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  2661. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  2662. % Definitions of (, ) and & used in args for functions.
  2663. % This is the definition of ( outside of all parentheses.
  2664. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
  2665. \global\advance\parencount by 1 }
  2666. % This is the definition of ( when already inside a level of parens.
  2667. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  2668. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  2669. % also in that case restore the outer-level definition of (.
  2670. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  2671. \global\advance \parencount by -1 }
  2672. % If we encounter &foo, then turn on ()-hacking afterwards
  2673. \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
  2674. \gdef\normalparens{\boldbrax\let&=\ampnr}
  2675. } % End of definition inside \activeparens
  2676. %% These parens (in \boldbrax) actually are a little bolder than the
  2677. %% contained text.  This is especially needed for [ and ]
  2678. \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
  2679. \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
  2680. % First, defname, which formats the header line itself.
  2681. % #1 should be the function name.
  2682. % #2 should be the type of definition, such as "Function".
  2683. \def\defname #1#2{%
  2684. % Get the values of \leftskip and \rightskip as they were
  2685. % outside the @def...
  2686. \dimen2=\leftskip
  2687. \advance\dimen2 by -\defbodyindent
  2688. \dimen3=\rightskip
  2689. \advance\dimen3 by -\defbodyindent
  2690. \noindent        %
  2691. \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
  2692. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  2693. \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
  2694. \parshape 2 0in \dimen0 \defargsindent \dimen1     %
  2695. % Now output arg 2 ("Function" or some such)
  2696. % ending at \deftypemargin from the right margin,
  2697. % but stuck inside a box of width 0 so it does not interfere with linebreaking
  2698. {% Adjust \hsize to exclude the ambient margins,
  2699. % so that \rightline will obey them.
  2700. \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
  2701. \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
  2702. % Make all lines underfull and no complaints:
  2703. \tolerance=10000 \hbadness=10000
  2704. \advance\leftskip by -\defbodyindent
  2705. \exdentamount=\defbodyindent
  2706. {\df #1}\enskip        % Generate function name
  2707. % Actually process the body of a definition
  2708. % #1 should be the terminating control sequence, such as \Edefun.
  2709. % #2 should be the "another name" control sequence, such as \defunx.
  2710. % #3 should be the control sequence that actually processes the header,
  2711. %    such as \defunheader.
  2712. \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2713. \medbreak %
  2714. % Define the end token that this defining construct specifies
  2715. % so that it will exit this group.
  2716. \def#1{\endgraf\endgroup\medbreak}%
  2717. \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
  2718. \parindent=0in
  2719. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2720. \exdentamount=\defbodyindent
  2721. \begingroup %
  2722. \catcode 61=\active % 61 is `='
  2723. \obeylines\activeparens\spacesplit#3}
  2724. \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
  2725. \medbreak %
  2726. % Define the end token that this defining construct specifies
  2727. % so that it will exit this group.
  2728. \def#1{\endgraf\endgroup\medbreak}%
  2729. \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
  2730. \parindent=0in
  2731. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2732. \exdentamount=\defbodyindent
  2733. \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
  2734. \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
  2735. \medbreak %
  2736. % Define the end token that this defining construct specifies
  2737. % so that it will exit this group.
  2738. \def#1{\endgraf\endgroup\medbreak}%
  2739. \def#2##1 ##2 {\def#4{##1}%
  2740. \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
  2741. \parindent=0in
  2742. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2743. \exdentamount=\defbodyindent
  2744. \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
  2745. % These parsing functions are similar to the preceding ones
  2746. % except that they do not make parens into active characters.
  2747. % These are used for "variables" since they have no arguments.
  2748. \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2749. \medbreak %
  2750. % Define the end token that this defining construct specifies
  2751. % so that it will exit this group.
  2752. \def#1{\endgraf\endgroup\medbreak}%
  2753. \def#2{\begingroup\obeylines\spacesplit#3}%
  2754. \parindent=0in
  2755. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2756. \exdentamount=\defbodyindent
  2757. \begingroup %
  2758. \catcode 61=\active %
  2759. \obeylines\spacesplit#3}
  2760. % This is used for \def{tp,vr}parsebody.  It could probably be used for
  2761. % some of the others, too, with some judicious conditionals.
  2762. \def\parsebodycommon#1#2#3{%
  2763.   \begingroup\inENV %
  2764.   \medbreak %
  2765.   % Define the end token that this defining construct specifies
  2766.   % so that it will exit this group.
  2767.   \def#1{\endgraf\endgroup\medbreak}%
  2768.   \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
  2769.   \parindent=0in
  2770.   \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2771.   \exdentamount=\defbodyindent
  2772.   \begingroup\obeylines
  2773. \def\defvrparsebody#1#2#3#4 {%
  2774.   \parsebodycommon{#1}{#2}{#3}%
  2775.   \spacesplit{#3{#4}}%
  2776. % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
  2777. % type is just `struct', because we lose the braces in `{struct
  2778. % termios}' when \spacesplit reads its undelimited argument.  Sigh.
  2779. % \let\deftpparsebody=\defvrparsebody
  2780. % So, to get around this, we put \empty in with the type name.  That
  2781. % way, TeX won't find exactly `{...}' as an undelimited argument, and
  2782. % won't strip off the braces.
  2783. \def\deftpparsebody #1#2#3#4 {%
  2784.   \parsebodycommon{#1}{#2}{#3}%
  2785.   \spacesplit{\parsetpheaderline{#3{#4}}}\empty
  2786. % Fine, but then we have to eventually remove the \empty *and* the
  2787. % braces (if any).  That's what this does, putting the result in \tptemp.
  2788. \def\removeemptybraces\empty#1\relax{\def\tptemp{#1}}%
  2789. % After \spacesplit has done its work, this is called -- #1 is the final
  2790. % thing to call, #2 the type name (which starts with \empty), and #3
  2791. % (which might be empty) the arguments.
  2792. \def\parsetpheaderline#1#2#3{%
  2793.   \removeemptybraces#2\relax
  2794.   #1{\tptemp}{#3}%
  2795. \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
  2796. \medbreak %
  2797. % Define the end token that this defining construct specifies
  2798. % so that it will exit this group.
  2799. \def#1{\endgraf\endgroup\medbreak}%
  2800. \def#2##1 ##2 {\def#4{##1}%
  2801. \begingroup\obeylines\spacesplit{#3{##2}}}%
  2802. \parindent=0in
  2803. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2804. \exdentamount=\defbodyindent
  2805. \begingroup\obeylines\spacesplit{#3{#5}}}
  2806. % Split up #2 at the first space token.
  2807. % call #1 with two arguments:
  2808. %  the first is all of #2 before the space token,
  2809. %  the second is all of #2 after that space token.
  2810. % If #2 contains no space token, all of it is passed as the first arg
  2811. % and the second is passed as empty.
  2812. {\obeylines
  2813. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
  2814. \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
  2815. \ifx\relax #3%
  2816. #1{#2}{}\else #1{#2}{#3#4}\fi}}
  2817. % So much for the things common to all kinds of definitions.
  2818. % Define @defun.
  2819. % First, define the processing that is wanted for arguments of \defun
  2820. % Use this to expand the args and terminate the paragraph they make up
  2821. \def\defunargs #1{\functionparens \sl
  2822. % Expand, preventing hyphenation at `-' chars.
  2823. % Note that groups don't affect changes in \hyphenchar.
  2824. \hyphenchar\tensl=0
  2825. \hyphenchar\tensl=45
  2826. \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
  2827. \interlinepenalty=10000
  2828. \advance\rightskip by 0pt plus 1fil
  2829. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2830. \def\deftypefunargs #1{%
  2831. % Expand, preventing hyphenation at `-' chars.
  2832. % Note that groups don't affect changes in \hyphenchar.
  2833. \functionparens
  2834. \tclose{#1}% avoid \code because of side effects on active chars
  2835. \interlinepenalty=10000
  2836. \advance\rightskip by 0pt plus 1fil
  2837. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2838. % Do complete processing of one @defun or @defunx line already parsed.
  2839. % @deffn Command forward-char nchars
  2840. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  2841. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  2842. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  2843. \catcode 61=\other % Turn off change made in \defparsebody
  2844. % @defun == @deffn Function
  2845. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  2846. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2847. \begingroup\defname {#1}{Function}%
  2848. \defunargs {#2}\endgroup %
  2849. \catcode 61=\other % Turn off change made in \defparsebody
  2850. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  2851. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  2852. % #1 is the data type.  #2 is the name and args.
  2853. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  2854. % #1 is the data type, #2 the name, #3 the args.
  2855. \def\deftypefunheaderx #1#2 #3\relax{%
  2856. \doind {fn}{\code{#2}}% Make entry in function index
  2857. \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
  2858. \deftypefunargs {#3}\endgroup %
  2859. \catcode 61=\other % Turn off change made in \defparsebody
  2860. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  2861. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  2862. % \defheaderxcond#1\relax$$$
  2863. % puts #1 in @code, followed by a space, but does nothing if #1 is null.
  2864. \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
  2865. % #1 is the classification.  #2 is the data type.  #3 is the name and args.
  2866. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  2867. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  2868. \def\deftypefnheaderx #1#2#3 #4\relax{%
  2869. \doind {fn}{\code{#3}}% Make entry in function index
  2870. \begingroup
  2871. \normalparens % notably, turn off `&' magic, which prevents
  2872. %               at least some C++ text from working
  2873. \defname {\defheaderxcond#2\relax$$$#3}{#1}%
  2874. \deftypefunargs {#4}\endgroup %
  2875. \catcode 61=\other % Turn off change made in \defparsebody
  2876. % @defmac == @deffn Macro
  2877. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  2878. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2879. \begingroup\defname {#1}{Macro}%
  2880. \defunargs {#2}\endgroup %
  2881. \catcode 61=\other % Turn off change made in \defparsebody
  2882. % @defspec == @deffn Special Form
  2883. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  2884. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2885. \begingroup\defname {#1}{Special Form}%
  2886. \defunargs {#2}\endgroup %
  2887. \catcode 61=\other % Turn off change made in \defparsebody
  2888. % This definition is run if you use @defunx
  2889. % anywhere other than immediately after a @defun or @defunx.
  2890. \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
  2891. \def\defunx #1 {\errmessage{@defunx in invalid context}}
  2892. \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
  2893. \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
  2894. \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
  2895. \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
  2896. % @defmethod, and so on
  2897. % @defop {Funny Method} foo-class frobnicate argument
  2898. \def\defop #1 {\def\defoptype{#1}%
  2899. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  2900. \def\defopheader #1#2#3{%
  2901. \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
  2902. \begingroup\defname {#2}{\defoptype{} on #1}%
  2903. \defunargs {#3}\endgroup %
  2904. % @defmethod == @defop Method
  2905. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  2906. \def\defmethodheader #1#2#3{%
  2907. \dosubind {fn}{\code{#2}}{on #1}% entry in function index
  2908. \begingroup\defname {#2}{Method on #1}%
  2909. \defunargs {#3}\endgroup %
  2910. % @defcv {Class Option} foo-class foo-flag
  2911. \def\defcv #1 {\def\defcvtype{#1}%
  2912. \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  2913. \def\defcvarheader #1#2#3{%
  2914. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2915. \begingroup\defname {#2}{\defcvtype{} of #1}%
  2916. \defvarargs {#3}\endgroup %
  2917. % @defivar == @defcv {Instance Variable}
  2918. \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
  2919. \def\defivarheader #1#2#3{%
  2920. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2921. \begingroup\defname {#2}{Instance Variable of #1}%
  2922. \defvarargs {#3}\endgroup %
  2923. % These definitions are run if you use @defmethodx, etc.,
  2924. % anywhere other than immediately after a @defmethod, etc.
  2925. \def\defopx #1 {\errmessage{@defopx in invalid context}}
  2926. \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
  2927. \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
  2928. \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
  2929. % Now @defvar
  2930. % First, define the processing that is wanted for arguments of @defvar.
  2931. % This is actually simple: just print them in roman.
  2932. % This must expand the args and terminate the paragraph they make up
  2933. \def\defvarargs #1{\normalparens #1%
  2934. \interlinepenalty=10000
  2935. \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
  2936. % @defvr Counter foo-count
  2937. \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
  2938. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  2939. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  2940. % @defvar == @defvr Variable
  2941. \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
  2942. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2943. \begingroup\defname {#1}{Variable}%
  2944. \defvarargs {#2}\endgroup %
  2945. % @defopt == @defvr {User Option}
  2946. \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
  2947. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2948. \begingroup\defname {#1}{User Option}%
  2949. \defvarargs {#2}\endgroup %
  2950. % @deftypevar int foobar
  2951. \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  2952. % #1 is the data type.  #2 is the name.
  2953. \def\deftypevarheader #1#2{%
  2954. \doind {vr}{\code{#2}}% Make entry in variables index
  2955. \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
  2956. \interlinepenalty=10000
  2957. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2958. \endgroup}
  2959. % @deftypevr {Global Flag} int enable
  2960. \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  2961. \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
  2962. \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
  2963. \interlinepenalty=10000
  2964. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2965. \endgroup}
  2966. % This definition is run if you use @defvarx
  2967. % anywhere other than immediately after a @defvar or @defvarx.
  2968. \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
  2969. \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
  2970. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  2971. \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
  2972. \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
  2973. % Now define @deftp
  2974. % Args are printed in bold, a slight difference from @defvar.
  2975. \def\deftpargs #1{\bf \defvarargs{#1}}
  2976. % @deftp Class window height width ...
  2977. \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
  2978. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  2979. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  2980. % This definition is run if you use @deftpx, etc
  2981. % anywhere other than immediately after a @deftp, etc.
  2982. \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
  2983. \message{cross reference,}
  2984. % Define cross-reference macros
  2985. \newwrite \auxfile
  2986. \newif\ifhavexrefs  % True if xref values are known.
  2987. \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  2988. % \setref{foo} defines a cross-reference point named foo.
  2989. \def\setref#1{%
  2990. \dosetq{#1-title}{Ytitle}%
  2991. \dosetq{#1-pg}{Ypagenumber}%
  2992. \dosetq{#1-snt}{Ysectionnumberandtype}}
  2993. \def\unnumbsetref#1{%
  2994. \dosetq{#1-title}{Ytitle}%
  2995. \dosetq{#1-pg}{Ypagenumber}%
  2996. \dosetq{#1-snt}{Ynothing}}
  2997. \def\appendixsetref#1{%
  2998. \dosetq{#1-title}{Ytitle}%
  2999. \dosetq{#1-pg}{Ypagenumber}%
  3000. \dosetq{#1-snt}{Yappendixletterandtype}}
  3001. % \xref, \pxref, and \ref generate cross-references to specified points.
  3002. % For \xrefX, #1 is the node name, #2 the name of the Info
  3003. % cross-reference, #3 the printed node name, #4 the name of the Info
  3004. % file, #5 the name of the printed manual.  All but the node name can be
  3005. % omitted.
  3006. \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
  3007. \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
  3008. \def\ref#1{\xrefX[#1,,,,,,,]}
  3009. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  3010.   \def\printedmanual{\ignorespaces #5}%
  3011.   \def\printednodename{\ignorespaces #3}%
  3012.   \setbox1=\hbox{\printedmanual}%
  3013.   \setbox0=\hbox{\printednodename}%
  3014.   \ifdim \wd0 = 0pt
  3015.     % No printed node name was explicitly given.
  3016.     \ifx\SETxref-automatic-section-title\relax %
  3017.       % Use the actual chapter/section title appear inside
  3018.       % the square brackets.  Use the real section title if we have it.
  3019.       \ifdim \wd1>0pt%
  3020.         % It is in another manual, so we don't have it.
  3021.         \def\printednodename{\ignorespaces #1}%
  3022.       \else
  3023.         \ifhavexrefs
  3024.           % We know the real title if we have the xref values.
  3025.           \def\printednodename{\refx{#1-title}}%
  3026.         \else
  3027.           % Otherwise just copy the Info node name.
  3028.           \def\printednodename{\ignorespaces #1}%
  3029.         \fi%
  3030.       \fi
  3031.       \def\printednodename{#1-title}%
  3032.     \else
  3033.       % Use the node name inside the square brackets.
  3034.       \def\printednodename{\ignorespaces #1}%
  3035.     \fi
  3036.   \fi
  3037.   % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
  3038.   % insert empty discretionaries after hyphens, which means that it will
  3039.   % not find a line break at a hyphen in a node names.  Since some manuals
  3040.   % are best written with fairly long node names, containing hyphens, this
  3041.   % is a loss.  Therefore, we give the text of the node name again, so it
  3042.   % is as if TeX is seeing it for the first time.
  3043.   \ifdim \wd1 > 0pt
  3044.     \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
  3045.   \else
  3046.     % _ (for example) has to be the character _ for the purposes of the
  3047.     % control sequence corresponding to the node, but it has to expand
  3048.     % into the usual \leavevmode...\vrule stuff for purposes of
  3049.     % printing. So we \turnoffactive for the \refx-snt, back on for the
  3050.     % printing, back off for the \refx-pg.
  3051.     {\turnoffactive \refx{#1-snt}{}}%
  3052.     \space [\printednodename],\space
  3053.     \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
  3054.   \fi
  3055. \endgroup}
  3056. % \dosetq is the interface for calls from other macros
  3057. % Use \turnoffactive so that punctuation chars such as underscore
  3058. % work in node names.
  3059. \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
  3060. \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
  3061. \next}}
  3062. % \internalsetq {foo}{page} expands into
  3063. % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
  3064. % When the aux file is read, ' is the escape character
  3065. \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
  3066. % Things to be expanded by \internalsetq
  3067. \def\Ypagenumber{\folio}
  3068. \def\Ytitle{\thissection}
  3069. \def\Ynothing{}
  3070. \def\Ysectionnumberandtype{%
  3071. \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
  3072. \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
  3073. \else \ifnum \subsubsecno=0 %
  3074. \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
  3075. \else %
  3076. \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
  3077. \fi \fi \fi }
  3078. \def\Yappendixletterandtype{%
  3079. \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
  3080. \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
  3081. \else \ifnum \subsubsecno=0 %
  3082. \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
  3083. \else %
  3084. \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
  3085. \fi \fi \fi }
  3086. \gdef\xreftie{'tie}
  3087. % Use TeX 3.0's \inputlineno to get the line number, for better error
  3088. % messages, but if we're using an old version of TeX, don't do anything.
  3089. \ifx\inputlineno\thisisundefined
  3090.   \let\linenumber = \empty % Non-3.0.
  3091. \else
  3092.   \def\linenumber{\the\inputlineno:\space}
  3093. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  3094. % If its value is nonempty, SUFFIX is output afterward.
  3095. \def\refx#1#2{%
  3096.   \expandafter\ifx\csname X#1\endcsname\relax
  3097.     % If not defined, say something at least.
  3098.     $\langle$un\-de\-fined$\rangle$%
  3099.     \ifhavexrefs
  3100.       \message{\linenumber Undefined cross reference `#1'.}%
  3101.     \else
  3102.       \ifwarnedxrefs\else
  3103.         \global\warnedxrefstrue
  3104.         \message{Cross reference values unknown; you must run TeX again.}%
  3105.       \fi
  3106.     \fi
  3107.   \else
  3108.     % It's defined, so just use it.
  3109.     \csname X#1\endcsname
  3110.   \fi
  3111.   #2% Output the suffix in any case.
  3112. % Read the last existing aux file, if any.  No error if none exists.
  3113. % This is the macro invoked by entries in the aux file.
  3114. \def\xrdef #1#2{
  3115. {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
  3116. \def\readauxfile{%
  3117. \begingroup
  3118. \catcode `\^^@=\other
  3119. \catcode `\
  3120. =\other
  3121. \catcode `\
  3122. =\other
  3123. \catcode `\^^C=\other
  3124. \catcode `\^^D=\other
  3125. \catcode `\^^E=\other
  3126. \catcode `\^^F=\other
  3127. \catcode `\^^G=\other
  3128. \catcode `\^^H=\other
  3129. \catcode `\
  3130. =\other
  3131. \catcode `\^^L=\other
  3132. \catcode `\
  3133. =\other
  3134. \catcode `\
  3135. =\other
  3136. \catcode `\
  3137. =\other
  3138. \catcode `\
  3139. =\other
  3140. \catcode `\
  3141. =\other
  3142. \catcode `\
  3143. =\other
  3144. \catcode `\
  3145. =\other
  3146. \catcode `\
  3147. =\other
  3148. \catcode `\
  3149. =\other
  3150. \catcode `\
  3151. =\other
  3152. \catcode `\
  3153. =\other
  3154. \catcode `\
  3155. =\other
  3156. \catcode 26=\other
  3157. \catcode `\^^[=\other
  3158. \catcode `\^^\=\other
  3159. \catcode `\^^]=\other
  3160. \catcode `\^^^=\other
  3161. \catcode `\^^_=\other
  3162. \catcode `\@=\other
  3163. \catcode `\^=\other
  3164. \catcode `\~=\other
  3165. \catcode `\[=\other
  3166. \catcode `\]=\other
  3167. \catcode`\"=\other
  3168. \catcode`\_=\other
  3169. \catcode`\|=\other
  3170. \catcode`\<=\other
  3171. \catcode`\>=\other
  3172. \catcode `\$=\other
  3173. \catcode `\#=\other
  3174. \catcode `\&=\other
  3175. % `\+ does not work, so use 43.
  3176. \catcode 43=\other
  3177. % Make the characters 128-255 be printing characters
  3178.   \count 1=128
  3179.   \def\loop{%
  3180.     \catcode\count 1=\other
  3181.     \advance\count 1 by 1
  3182.     \ifnum \count 1<256 \loop \fi
  3183. % the aux file uses ' as the escape.
  3184. % Turn off \ as an escape so we do not lose on
  3185. % entries which were dumped with control sequences in their names.
  3186. % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
  3187. % Reference to such entries still does not work the way one would wish,
  3188. % but at least they do not bomb out when the aux file is read in.
  3189. \catcode `\{=1 \catcode `\}=2
  3190. \catcode `\%=\other
  3191. \catcode `\'=0
  3192. \catcode `\\=\other
  3193. \openin 1 \jobname.aux
  3194. \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
  3195. \global\warnedobstrue
  3196. % Open the new aux file.  Tex will close it automatically at exit.
  3197. \openout \auxfile=\jobname.aux
  3198. \endgroup}
  3199. % Footnotes.
  3200. \newcount \footnoteno
  3201. % The trailing space in the following definition for supereject is
  3202. % vital for proper filling; pages come out unaligned when you do a
  3203. % pagealignmacro call if that space before the closing brace is
  3204. % removed.
  3205. \def\supereject{\par\penalty -20000\footnoteno =0 }
  3206. % @footnotestyle is meaningful for info output only..
  3207. \let\footnotestyle=\comment
  3208. \let\ptexfootnote=\footnote
  3209. {\catcode `\@=11
  3210. % Auto-number footnotes.  Otherwise like plain.
  3211. \gdef\footnote{%
  3212.   \global\advance\footnoteno by \@ne
  3213.   \edef\thisfootno{$^{\the\footnoteno}$}%
  3214.   % In case the footnote comes at the end of a sentence, preserve the
  3215.   % extra spacing after we do the footnote number.
  3216.   \let\@sf\empty
  3217.   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  3218.   % Remove inadvertent blank space before typesetting the footnote number.
  3219.   \unskip
  3220.   \thisfootno\@sf
  3221.   \footnotezzz
  3222. % Don't bother with the trickery in plain.tex to not require the
  3223. % footnote text as a parameter.  Our footnotes don't need to be so general.
  3224. \long\gdef\footnotezzz#1{\insert\footins{%
  3225.   % We want to typeset this text as a normal paragraph, even if the
  3226.   % footnote reference occurs in (for example) a display environment.
  3227.   % So reset some parameters.
  3228.   \interlinepenalty\interfootnotelinepenalty
  3229.   \splittopskip\ht\strutbox % top baseline for broken footnotes
  3230.   \splitmaxdepth\dp\strutbox
  3231.   \floatingpenalty\@MM
  3232.   \leftskip\z@skip
  3233.   \rightskip\z@skip
  3234.   \spaceskip\z@skip
  3235.   \xspaceskip\z@skip
  3236.   \parindent\defaultparindent
  3237.   % Hang the footnote text off the number.
  3238.   \hang
  3239.   \textindent{\thisfootno}%
  3240.   % Don't crash into the line above the footnote text.  Since this
  3241.   % expands into a box, it must come within the paragraph, lest it
  3242.   % provide a place where TeX can split the footnote.
  3243.   \footstrut
  3244.   #1\strut}%
  3245. }%end \catcode `\@=11
  3246. % Set the baselineskip to #1, and the lineskip and strut size
  3247. % correspondingly.  There is no deep meaning behind these magic numbers
  3248. % used as factors; they just match (closely enough) what Knuth defined.
  3249. \def\lineskipfactor{.08333}
  3250. \def\strutheightpercent{.70833}
  3251. \def\strutdepthpercent {.29167}
  3252. \def\setleading#1{%
  3253.   \normalbaselineskip = #1\relax
  3254.   \normallineskip = \lineskipfactor\normalbaselineskip
  3255.   \normalbaselines
  3256.   \setbox\strutbox =\hbox{%
  3257.     \vrule width0pt height\strutheightpercent\baselineskip
  3258.                     depth \strutdepthpercent \baselineskip
  3259. % @| inserts a changebar to the left of the current line.  It should
  3260. % surround any changed text.  This approach does *not* work if the
  3261. % change spans more than two lines of output.  To handle that, we would
  3262. % have adopt a much more difficult approach (putting marks into the main
  3263. % vertical list for the beginning and end of each change).
  3264. \def\|{%
  3265.   % \vadjust can only be used in horizontal mode.
  3266.   \leavevmode
  3267.   % Append this vertical mode material after the current line in the output.
  3268.   \vadjust{%
  3269.     % We want to insert a rule with the height and depth of the current
  3270.     % leading; that is exactly what \strutbox is supposed to record.
  3271.     \vskip-\baselineskip
  3272.     %
  3273.     % \vadjust-items are inserted at the left edge of the type.  So
  3274.     % the \llap here moves out into the left-hand margin.
  3275.     \llap{%
  3276.       %
  3277.       % For a thicker or thinner bar, change the `1pt'.
  3278.       \vrule height\baselineskip width1pt
  3279.       %
  3280.       % This is the space between the bar and the text.
  3281.       \hskip 12pt
  3282.     }%
  3283. % For a final copy, take out the rectangles
  3284. % that mark overfull boxes (in case you have decided
  3285. % that the text looks ok even though it passes the margin).
  3286. \def\finalout{\overfullrule=0pt}
  3287. % End of control word definitions.
  3288. \message{and turning on texinfo input format.}
  3289. \def\openindices{%
  3290.    \newindex{cp}%
  3291.    \newcodeindex{fn}%
  3292.    \newcodeindex{vr}%
  3293.    \newcodeindex{tp}%
  3294.    \newcodeindex{ky}%
  3295.    \newcodeindex{pg}%
  3296. % Set some numeric style parameters, for 8.5 x 11 format.
  3297. %\hsize = 6.5in
  3298. \newdimen\defaultparindent \defaultparindent = 15pt
  3299. \parindent = \defaultparindent
  3300. \parskip 18pt plus 1pt
  3301. \setleading{15pt}
  3302. \advance\topskip by 1.2cm
  3303. % Prevent underfull vbox error messages.
  3304. \vbadness=10000
  3305. % Following George Bush, just get rid of widows and orphans.
  3306. \widowpenalty=10000
  3307. \clubpenalty=10000
  3308. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  3309. % using an old version of TeX, don't do anything.  We want the amount of
  3310. % stretch added to depend on the line length, hence the dependence on
  3311. % \hsize.  This makes it come to about 9pt for the 8.5x11 format.
  3312. \ifx\emergencystretch\thisisundefined
  3313.   % Allow us to assign to \emergencystretch anyway.
  3314.   \def\emergencystretch{\dimen0}%
  3315. \else
  3316.   \emergencystretch = \hsize
  3317.   \divide\emergencystretch by 45
  3318. % Use @smallbook to reset parameters for 7x9.5 format  (or else 7x9.25)
  3319. \def\smallbook{
  3320. % These values for secheadingskip and subsecheadingskip are
  3321. % experiments.  RJC 7 Aug 1992
  3322. \global\secheadingskip = 17pt plus 6pt minus 3pt
  3323. \global\subsecheadingskip = 14pt plus 6pt minus 3pt
  3324. \global\lispnarrowing = 0.3in
  3325. \setleading{12pt}
  3326. \advance\topskip by -1cm
  3327. \global\parskip 3pt plus 1pt
  3328. \global\hsize = 5in
  3329. \global\vsize=7.5in
  3330. \global\tolerance=700
  3331. \global\hfuzz=1pt
  3332. \global\contentsrightmargin=0pt
  3333. \global\deftypemargin=0pt
  3334. \global\defbodyindent=.5cm
  3335. \global\pagewidth=\hsize
  3336. \global\pageheight=\vsize
  3337. \global\let\smalllisp=\smalllispx
  3338. \global\let\smallexample=\smalllispx
  3339. \global\def\Esmallexample{\Esmalllisp}
  3340. % Use @afourpaper to print on European A4 paper.
  3341. \def\afourpaper{
  3342. \global\tolerance=700
  3343. \global\hfuzz=1pt
  3344. \setleading{12pt}
  3345. \global\parskip 15pt plus 1pt
  3346. \global\vsize= 53\baselineskip
  3347. \advance\vsize by \topskip
  3348. %\global\hsize=   5.85in     % A4 wide 10pt
  3349. \global\hsize=  6.5in
  3350. \global\outerhsize=\hsize
  3351. \global\advance\outerhsize by 0.5in
  3352. \global\outervsize=\vsize
  3353. \global\advance\outervsize by 0.6in
  3354. \global\pagewidth=\hsize
  3355. \global\pageheight=\vsize
  3356. % Allow control of the text dimensions.  Parameters in order: textheight;
  3357. % textwidth; \voffset; \hoffset (!); binding offset.  All require a dimension;
  3358. % header is additional; added length extends the bottom of the page.
  3359. \def\changepagesizes#1#2#3#4#5
  3360. {\global\vsize= #1
  3361.  \advance\vsize by \topskip
  3362.  \global\voffset= #3
  3363.  \global\hsize= #2
  3364.  \global\outerhsize=\hsize
  3365.  \global\advance\outerhsize by 0.5in
  3366.  \global\outervsize=\vsize
  3367.  \global\advance\outervsize by 0.6in
  3368.  \global\pagewidth=\hsize
  3369.  \global\pageheight=\vsize
  3370.  \global\normaloffset= #4
  3371.  \global\bindingoffset= #5}
  3372. % This layout is compatible with Latex on A4 paper.
  3373. \def\afourlatex{\changepagesizes{22cm}{15cm}{7mm}{4.6mm}{5mm}}
  3374. % Define macros to output various characters with catcode for normal text.
  3375. \catcode`\"=\other
  3376. \catcode`\~=\other
  3377. \catcode`\^=\other
  3378. \catcode`\_=\other
  3379. \catcode`\|=\other
  3380. \catcode`\<=\other
  3381. \catcode`\>=\other
  3382. \catcode`\+=\other
  3383. \def\normaldoublequote{"}
  3384. \def\normaltilde{~}
  3385. \def\normalcaret{^}
  3386. \def\normalunderscore{_}
  3387. \def\normalverticalbar{|}
  3388. \def\normalless{<}
  3389. \def\normalgreater{>}
  3390. \def\normalplus{+}
  3391. % This macro is used to make a character print one way in ttfont
  3392. % where it can probably just be output, and another way in other fonts,
  3393. % where something hairier probably needs to be done.
  3394. % #1 is what to print if we are indeed using \tt; #2 is what to print
  3395. % otherwise.  Since all the Computer Modern typewriter fonts have zero
  3396. % interword stretch (and shrink), and it is reasonable to expect all
  3397. % typewriter fonts to have this, we can check that font parameter.
  3398. \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
  3399. % Turn off all special characters except @
  3400. % (and those which the user can use as if they were ordinary).
  3401. % Most of these we simply print from the \tt font, but for some, we can
  3402. % use math or other variants that look better in normal text.
  3403. \catcode`\"=\active
  3404. \def\activedoublequote{{\tt \char '042}}
  3405. \let"=\activedoublequote
  3406. \catcode`\~=\active
  3407. \def~{{\tt \char '176}}
  3408. \chardef\hat=`\^
  3409. \catcode`\^=\active
  3410. \def^{{\tt \hat}}
  3411. \catcode`\_=\active
  3412. \def_{\ifusingtt\normalunderscore\_}
  3413. % Subroutine for the previous macro.
  3414. \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
  3415. % \lvvmode is equivalent in function to \leavevmode.
  3416. % Using \leavevmode runs into trouble when written out to
  3417. % an index file due to the expansion of \leavevmode into ``\unhbox
  3418. % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
  3419. % magic tricks with @.
  3420. \def\lvvmode{\vbox to 0pt{}}
  3421. \catcode`\|=\active
  3422. \def|{{\tt \char '174}}
  3423. \chardef \less=`\<
  3424. \catcode`\<=\active
  3425. \def<{{\tt \less}}
  3426. \chardef \gtr=`\>
  3427. \catcode`\>=\active
  3428. \def>{{\tt \gtr}}
  3429. \catcode`\+=\active
  3430. \def+{{\tt \char 43}}
  3431. %\catcode 27=\active
  3432. %\def^^[{$\diamondsuit$}
  3433. % Set up an active definition for =, but don't enable it most of the time.
  3434. {\catcode`\==\active
  3435. \global\def={{\tt \char 61}}}
  3436. \catcode`\@=0
  3437. % \rawbackslashxx output one backslash character in current font
  3438. \global\chardef\rawbackslashxx=`\\
  3439. %{\catcode`\\=\other
  3440. %@gdef@rawbackslashxx{\}}
  3441. % \rawbackslash redefines \ as input to do \rawbackslashxx.
  3442. {\catcode`\\=\active
  3443. @gdef@rawbackslash{@let\=@rawbackslashxx }}
  3444. % \normalbackslash outputs one backslash in fixed width font.
  3445. \def\normalbackslash{{\tt\rawbackslashxx}}
  3446. % Say @foo, not \foo, in error messages.
  3447. \escapechar=`\@
  3448. % \catcode 17=0   % Define control-q
  3449. \catcode`\\=\active
  3450. % Used sometimes to turn off (effectively) the active characters
  3451. % even after parsing them.
  3452. @def@turnoffactive{@let"=@normaldoublequote
  3453. @let\=@realbackslash
  3454. @let~=@normaltilde
  3455. @let^=@normalcaret
  3456. @let_=@normalunderscore
  3457. @let|=@normalverticalbar
  3458. @let<=@normalless
  3459. @let>=@normalgreater
  3460. @let+=@normalplus}
  3461. @def@normalturnoffactive{@let"=@normaldoublequote
  3462. @let\=@normalbackslash
  3463. @let~=@normaltilde
  3464. @let^=@normalcaret
  3465. @let_=@normalunderscore
  3466. @let|=@normalverticalbar
  3467. @let<=@normalless
  3468. @let>=@normalgreater
  3469. @let+=@normalplus}
  3470. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  3471. % That is what \eatinput is for; after that, the `\' should revert to printing
  3472. % a backslash.
  3473. @gdef@eatinput input texinfo{@fixbackslash}
  3474. @global@let\ = @eatinput
  3475. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  3476. % the first `\{ in the file would cause an error. This macro tries to fix
  3477. % that, assuming it is called before the first `\' could plausibly occur.
  3478. @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
  3479. %% These look ok in all fonts, so just make them not special.  The @rm below
  3480. %% makes sure that the current font starts out as the newly loaded cmr10
  3481. @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
  3482. @textfonts
  3483. @c Local variables:
  3484. @c page-delimiter: "^\\\\message"
  3485. @c End:
  3486.